1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ampache_ynh.git synced 2024-09-03 18:15:55 +02:00

first commit

This commit is contained in:
root 2014-06-21 18:58:49 +00:00
commit 0697a8056d
1747 changed files with 398402 additions and 0 deletions

815
conf/ampache.cfg.php Normal file
View file

@ -0,0 +1,815 @@
;#<?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 = 16
;###################
; Path Vars #
;###################
; The http host of your server.
; If not set, retrieved automatically from client request.
; This setting is required for WebSocket server
; DEFAULT: ""
http_host = "DOMAINTOCHANGE"
; The path to your ampache install
; Do not put a trailing / on this path
; For example if your site is located at http://localhost
; than you do not need to enter anything for the web_path
; if it is located at http://localhost/music you need to
; set web_path to /music
; DEFAULT: ""
web_path = "PATHTOCHANGE"
;##############################
; Session and Login Variables #
;##############################
; Hostname of your database
; DEFAULT: localhost
database_hostname = "localhost"
; Port to use when connecting to your database
; DEFAULT: none
;database_port = 3306
; Name of your ampache database
; DEFAULT: ampache
database_name = "yunobase"
; Username for your ampache database
; DEFAULT: ""
database_username = "yunouser"
; Password for your ampache database, this can not be blank
; this is a 'forced' security precaution, the default value
; will not work
; DEFAULT: ""
database_password = "yunopass"
; Length that a session will last expressed in seconds. Default is
; one hour.
; DEFAULT: 3600
session_length = "3600"
; Length that the session for a single streaming instance will last
; the default is two hours. With some clients, and long songs this can
; cause playback to stop, increase this value if you experience that
; DEFAULT: 7200
stream_length = "7200"
; This length defines how long a 'remember me' session and cookie will
; last, the default is 7200, same as length. It is up to the administrator
; of the box to increase this, for reference 86400 = 1 day
; 604800 = 1 week and 2419200 = 1 month
; DEFAULT: 86400
remember_length = "86400"
; Name of the Session/Cookie that will sent to the browser
; default should be fine
; DEFAULT: ampache
session_name = "ampache"
; Lifetime of the Cookie, 0 == Forever (until browser close) , otherwise in terms of seconds
; If you want cookies to last past a browser close set this to a value in seconds.
; DEFAULT: 0
session_cookielife = "0"
; Is the cookie a "secure" cookie? This should only be set to 1 (true) if you are
; running a secure site (HTTPS).
; DEFAULT: 0
session_cookiesecure = "1"
; Auth Methods
; This defines which auth methods Auth will attempt to use and in which order.
; If auto_create isn't enabled the user must exist locally.
; DEFAULT: mysql
; VALUES: mysql,ldap,http,pam,external,openid
auth_methods = "http,mysql"
; External authentication
; This sets the helper used for external authentication. It should conform to
; the interface used by mod_authnz_external
; DEFAULT: none
;external_authenticator = "/usr/sbin/pwauth"
; Automatic local password updating
; Determines whether successful authentication against an external source
; will result in an update to the password stored in the database.
; A locally stored password is needed for API access.
; DEFAULT: false
;auth_password_save = "false"
; Logout redirection target
; Defaults to our own login.php, but we can override it here if, for instance,
; we want to redirect to an SSO provider instead.
logout_redirect = "https://DOMAINTOCHANGE/yunohost/sso/?action=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|mp4|aac|ogg|rm|wma|asf|flac|spx|ra|ape|shn|wv
catalog_file_pattern = "mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|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|flv|m4v|webm
catalog_video_pattern = "avi|mpg|flv|m4v|webm"
; 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
; will not work without this on.
; NOTE: Default Behavior is DENY FROM ALL
; DEFAULT: true
access_control = "true"
; Require Session
; If this is set to true ampache will make sure that the URL passed when
; attempting to retrieve a song contains a valid Session ID This prevents
; others from guessing URL's. This setting is ignored if you have use_auth
; disabled.
; DEFAULT: true
require_session = "true"
; Require LocalNet Session
; If this is set to true then ampache will require that a valid session
; is passed even on hosts defined in the Local Network ACL. This setting
; has no effect if access_control is not enabled
; DEFAULT: true
require_localnet_session = "true"
; Multiple Logins
; Added by Vlet 07/25/07
; When this setting is enabled a user may only be logged in from a single
; IP address at any one time, this is to prevent sharing of accounts
; DEFAULT: false
;prevent_multiple_logins = "false"
; 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
; regardless of their preferences. Requires access_control to be enabled
; DEFAULT: false
;downsample_remote = "false"
; Track User IPs
; If this is enabled Ampache will log the IP of every completed login
; it will store user,ip,time at one row per login. The results are
; displayed in Admin --> Users
; DEFAULT: false
;track_user_ip = "false"
; User IP Cardinality
; This defines how many days worth of IP history Ampache will track
; As it is one row per login on high volume sites you will want to
; clear it every now and then.
; DEFAULT: 42 days
;user_ip_cardinality = "42"
; Allow Zip Download
; This setting allows/disallows using zlib to zip up an entire
; playlist/album for download. Even if this is turned on you will
; still need to enabled downloading for the specific user you
; want to be able to use this function
; DEFAULT: false
;allow_zip_download = "false"
; File Zip Download
; This settings tells Ampache to attempt to save the zip file
; to the filesystem instead of creating it in memory, you must
; also set tmp_dir_path in order for this to work
; DEFAULT: false
;file_zip_download = "false"
; File Zip Comment
; This is an optional configuration option that adds a comment
; to your zip files, this only applies if you've got allow_zip_downloads
; DEFAULT: Ampache - Zip Batch Download
;file_zip_comment = "Ampache - Zip Batch Download"
; Waveform
; This settings tells Ampache to attempt to generate a waveform
; for each song. It requires transcode and encode_args_wav settings.
; You must also set tmp_dir_path in order for this to work
; DEFAULT: false
;waveform = "false"
; Waveform color
; The waveform color.
; DEFAULT: #FF0000
;waveform_color = "#FF0000"
; Temporary Directory Path
; If File Zip Download or Waveform is enabled this must be set to tell
; Ampache which directory to save the temporary file to. Do not put a
; trailing slash or this will not work.
; DEFAULT: false
;tmp_dir_path = "false"
; This setting throttles a persons downloading to the specified
; bytes per second. This is not a 100% guaranteed function, and
; you should really use a server based rate limiter if you want
; to do this correctly.
; DEFAULT: off
; 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 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, plus any others you've installed.
; DEFAULT: getID3 filename
metadata_order = "getID3,filename"
; Un comment if don't want ampache to follow symlinks
; DEFAULT: false
;no_symlinks = "false"
; Use auth?
; If this is set to "Yes" ampache will require a valid
; Username and password. If this is set to false then ampache
; will not ask you for a username and password. false is only
; recommended for internal only instances
; DEFAULT true
use_auth = "true"
; Default Auth Level
; If use_auth is set to false then this option is used
; to determine the permission level of the 'default' users
; default is administrator. This setting only takes affect
; if use_auth if false
; POSSIBLE VALUES: user, admin, manager, guest
; DEFAULT: admin
default_auth_level = "admin"
; 5 Star Ratings
; This allows ratings for almost any object in ampache
; POSSIBLE VALUES: false true
; DEFAULT: true
ratings = "true"
; User flags
; This allows user flags for almost any object in ampache
; POSSIBLE VALUES: false true
; DEFAULT: true
userflags = "true"
; Direct play
; This allows user to play directly a song or album
; POSSIBLE VALUES: false true
; DEFAULT: true
directplay = "true"
; Sociable
; This turns on / off all of the "social" features of ampache
; default is on, but if you don't care and just want music
; turn this off to disable all social features.
; DEFAULT: true
sociable = "true"
; Notify
; This turns on / off all Ampache notifications
; DEFAULT: true
notify = "true"
; This options will turn on/off Demo Mode
; If Demo mode is on you can not play songs or update your catalog
; in other words.. leave this commented out
; DEFAULT: false
;demo_mode = "false"
; Caching
; This turns the caching mechanisms on or off, due to a large number of
; problems with people with very large catalogs and low memory settings
; this is off by default as it does significantly increase the memory
; requirments on larger catalogs. If you have the memory this can create
; a 2-3x speed improvement.
; DEFAULT: false
memory_cache = "true"
; Memory Limit
; This defines the "Min" memory limit for PHP if your php.ini
; has a lower value set Ampache will set it up to this. If you
; set it below 16MB getid3() will not work!
; DEFAULT: 32
;memory_limit = 32
; Album Art Preferred Filename
; Specify a filename to look for if you always give the same filename
; i.e. "folder.jpg" Ampache currently only supports jpg/gif and png
; Especially useful if you have a front and a back image in a folder
; comment out if ampache should search for any jpg,gif or png
; DEFAULT: folder.jpg
;album_art_preferred_filename = "folder.jpg"
; Resize Images * Requires PHP-GD *
; Set this to true if you want Ampache to resize the Album
; art on the fly, this increases load time and CPU usage
; and also requires the PHP-GD library. This is very useful
; If you have high-quality album art and a small upload cap
; DEFAULT: false
;resize_images = "false"
; Art Gather Order
; Simply arrange the following in the order you would like
; ampache to search. If you want to disable one of the search
; methods simply leave it out. DB should be left as the first
; method unless you want it to overwrite what's already in the
; database
; POSSIBLE VALUES: db tags folder amazon lastfm musicbrainz google
; DEFAULT: db,tags,folder,musicbrainz,lastfm,google
art_order = "db,tags,folder,musicbrainz,lastfm,google"
; Amazon Developer Key
; These are needed in order to actually use the amazon album art
; Your public key is your 'Access Key ID'
; Your private key is your 'Secret Access Key'
; DEFAULT: false
;amazon_developer_public_key = ""
;amazon_developer_private_key = ""
; Recommendations
; Set this to true to enable display of similar artists or albums
; while browsing. Requires Last.FM.
; DEFAULT: false
;show_similar = "false"
; Concerts
; Set this to true to enable display of artist concerts
; Requires Last.FM.
; DEFAULT: false
;show_concerts = "false"
; Last.FM API Key
; Set this to your Last.FM api key to actually use Last.FM for
; recommendations.
;lastfm_api_key = ""
; Wanted
; Set this to true to enable display missing albums and the
; possibility for users to mark it as wanted.
; DEFAULT: false
;wanted = "false"
; Wanted types
; Set the allowed types of wanted releases (album,compilation,single,ep,live,remix,promotion,official)
; DEFAULT: album,official
wanted_types = "album,official"
; Wanted Auto Accept
; Mark wanted requests as accepted by default (no content manager agreement required)
; DEFAULT: false
;wanted_auto_accept = "false"
; EchoNest API key
; EchoNest provides several music services. Currently used for missing song 30 seconds preview.
;echonest_api_key = ""
; Broadcasts
; Allow users to broadcast music.
; This feature requires advanced server configuration, please take a look on the wiki for more information.
; DEFAULT: false
;broadcast = "false"
; Web Socket address
; Declare the web socket server address
; DEFAULT: determined automatically
;websocket_address = "ws://localhost:8100"
; Amazon base urls
; An array of Amazon sites to search.
; NOTE: This will search each of these sites in turn so don't expect it
; to be lightning fast!
; It is strongly recommended that only one of these is selected at any
; one time
; POSSIBLE VALUES:
; http://webservices.amazon.com
; http://webservices.amazon.co.uk
; http://webservices.amazon.de
; http://webservices.amazon.co.jp
; http://webservices.amazon.fr
; http://webservices.amazon.ca
; Default: http://webservices.amazon.com
;amazon_base_urls = "http://webservices.amazon.com"
; max_amazon_results_pages
; The maximum number of results pages to pull from EACH amazon site
; NOTE: The art search pages through the results returned by your search
; up to this number of pages. As with the base_urls above, this is going
; to take more time, the more pages you ask it to process.
; Of course a good search will return only a few matches anyway.
; It is strongly recommended that you do _not_ change this value
; DEFAULT: 1 page (10 items)
max_amazon_results_pages = "1"
; Debug
; If this is enabled Ampache will write debugging information to the log file
; DEFAULT: false
debug = "true"
; Debug Level
; This should always be set in conjunction with the
; debug option, it defines how prolific you want the
; debugging in ampache to be. values are 1-5.
; 1 == Errors only
; 2 == Error + Failures (login attempts etc.)
; 3 == ??
; 4 == ?? (Profit!)
; 5 == Information (cataloging progress etc.)
; DEFAULT: 5
debug_level = "5"
; Path to Log File
; This defines where you want ampache to log events to
; this will only happen if debug is turned on. Do not
; include trailing slash. You will need to make sure that
; the specified directory exists and your HTTP server has
; write access.
; DEFAULT: NULL
log_path = "/var/www/ampache/log"
; Log filename 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"
; Charset of generated HTML pages
; Default of UTF-8 should work for most people
; DEFAULT: UTF-8
site_charset = "UTF-8"
; Locale Charset
; In some cases this has to be different
; in order for XHTML and other things to work
; This is disabled by default, enabled only
; if needed. It's specifically needed for Russian
; so that is the default
; DEFAULT: cp1251
;lc_charset = cp1251
; 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"
;#########################################################
; Custom actions (optional) #
;#########################################################
; Your custom play action title
;custom_play_action_title_0 = ""
; Your custom play action icon name (stored as /images/icon_[your_image].png)
;custom_play_action_icon_0 = ""
; Your custom action script, where:
; - %f: the media file path
; - %c: the excepted codec target (mp3, ogg, ...)
; - %a: the artist name
; - %A: the album name
; - %t: the song title
;custom_play_action_run_0 = ""
; Example for Karaoke playing
;custom_play_action_title_0 = "Karaoke"
;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) #
;#########################################################
; LDAP filter string to use (required)
; For OpenLDAP use "uid"
; For Microsoft Active Directory (MAD) use "sAMAccountName"
; DEFAULT: null
; ldap_filter = "sAMAccountName"
; LDAP objectclass (required)
; OpanLDAP objectclass = "*"
; MAD objectclass = "organizationalPerson"
; DEFAULT null
ldap_objectclass = "posixAccount"
; Initial credentials to bind with for searching (optional)
; DEFAULT: null
;ldap_username = ""
;ldap_password = ""
; Require that the user is in a specific group (optional)
; DEFAULT: null
;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
ldap_search_dn = "dc=yunohost,dc=org"
; This is the address of your ldap server (required)
; DEFAULT: null
ldap_url = "192.168.1.88"
; Attributes where additional user information is stored (optional)
; OpenLDAP ldap_name_field = "cn"
; MAD ldap_name_field = "displayname"
; DEFAULT: null
;ldap_email_field = "mail"
ldap_name_field = "cn"
;#########################################################
; OpenID login info (optional) #
;#########################################################
; Requires specific OpenID Provider Authentication Policy
; DEFAULT: null
; VALUES: PAPE_AUTH_MULTI_FACTOR_PHYSICAL,PAPE_AUTH_MULTI_FACTOR,PAPE_AUTH_PHISHING_RESISTANT
;openid_required_pape = ""
;#########################################################
; Public Registration settings, defaults to disabled #
;#########################################################
; This setting will silently create an ampache account
; for anyone who can login using ldap (or any other login
; extension). The default is to create new users as guests
; see auto_user config option if you would like to change this
; DEFAULT: false
auto_create = "true"
; This setting turns on/off public registration. It is
; recommended you leave this off, as it will allow anyone to
; sign up for an account on your server.
; REMEMBER: don't forget to set the mail from address further down in the config.
; DEFAULT: false
;allow_public_registration = "false"
; Require Captcha Text on Image confirmation
; Turning this on requires the user to correctly
; type in the letters in the image created by Captcha
; Default is off because its very hard to detect if it failed
; to draw, or they failed to enter it.
; DEFAULT: false
;captcha_public_reg = "false"
; This setting turns on/off admin notification of registration.
; DEFAULT: false
;admin_notify_reg = "false"
; This setting determines whether the user will be created as a disabled user.
; If this is on, an administrator will need to manually enable the account
; before it's usable.
; DEFAULT: false
;admin_enable_required = "false"
; This setting will allow all registrants/ldap/http users
; to be auto-approved as a user. By default, they will be
; added as a guest and must be promoted by the admin.
; POSSIBLE VALUES: guest, user, admin
; DEFAULT: guest
auto_user = "admin"
; This will display the user agreement when registering
; For agreement text, edit templates/user_agreement.php
; User will need to accept the agreement before they can register
; DEFAULT: false
;user_agreement = "false"
;########################################################
; These options control the dynamic downsampling based #
; on current usage #
; *Note* Transcoding must be enabled and working #
;########################################################
; Attempt to optimize bandwidth by dynamically lowering the bit rate of new
; streams. Since the bit rate is only adjusted at the beginning of a song, the
; actual cumulative bitrate for concurrent streams can be up to around
; double the configured value. It also only applies to streams that are
; transcoded.
; DEFAULT: none
max_bit_rate = 576
; New dynamically downsampled streams will be denied if they are forced below
; this value.
; DEFAULT: 8
min_bit_rate = 48
;######################################################
; These are commands used to transcode non-streaming
; formats to the target file type for streaming.
; This can be useful in re-encoding file types that don't stream
; very well, or if your player doesn't support some file types.
;
; 'Downsampling' will also use these commands.
;
; To state the bleeding obvious, any programs referenced in the transcode
; commands must be installed, in the web server's search path (or referenced
; by their full path), and executable by the web server.
; Input type selection
; TYPE is the extension. 'allowed' certifies that transcoding works properly for
; this input format. 'required' further forbids the direct streaming of a format
; (e.g. if you store everything in FLAC, but don't want to ever stream that.)
; transcode_TYPE = {allowed|required|false}
; DEFAULT: false
;transcode_m4a = allowed
transcode_flac = required
;transcode_mpc = required
transcode_mp3 = allowed
; Default output format
; DEFAULT: none
encode_target = mp3
; Override the default output format on a per-type basis
; encode_target_TYPE = TYPE
; DEFAULT: none
; encode_target_flac = ogg
; Allow clients to override transcode settings (output type, bitrate, codec ...)
; DEFAULT: true
transcode_player_customize = "1"
; Command configuration. Substitutions will be made as follows:
; %FILE% => filename
; %SAMPLE% => target sample rate
; You can do fancy things like VBR, but consider whether the consequences are
; acceptable in your environment.
; Master transcode command
; transcode_cmd should be a single command that supports multiple file types,
; such as ffmpeg or avconv. It's still possible to make a configuration that's
; equivalent to the old default, but if you find that necessary you should be
; clever enough to figure out how on your own.
; DEFAULT: none
;transcode_cmd = "ffmpeg -i %FILE%"
transcode_cmd = "ffmpeg -i %FILE%"
;transcode_cmd = "/usr/bin/neatokeen %FILE%"
; Specific transcode commands
; It shouldn't be necessary in most cases, but you can override the transcode
; command for specific source formats. It still needs to accept the
; encoding arguments, so the easiest approach is to use your normal command as
; a clearing-house.
; transcode_cmd_TYPE = TRANSCODE_CMD
;transcode_cmd_mid = "timidity -Or -o – %FILE% | ffmpeg -f s16le -i pipe:0"
; Encoding arguments
; 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_ogg = "-vn -b:a max\(%SAMPLE%K\,49K\) -acodec libvorbis -vcodec libtheora -f ogg pipe:1"
encode_args_mp3 = "-vn -b:a %SAMPLE%K -acodec libmp3lame -f mp3 pipe:1"
encode_args_ogv = "-vcodec libtheora -acodec libvorbis -ar 44100 -f ogv pipe:1"
encode_args_mp4 = "-profile:0 baseline -frag_duration 2 -ar 44100 -f mp4 pipe:1"
;######################################################
; 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
;proxy_host = "192.168.0.1"
;proxy_port = "8080"
;proxy_user = ""
;proxy_pass = ""
; If Ampache is behind an https reverse proxy, force use HTTPS protocol.
;Default: false
force_ssl = true
;#############################
; Mail Settings #
;#############################
;Method used to send mail
;POSSIBLE VALUES: smtp sendmail php
;DEFAULT: php
;mail_type = "php"
;Mail domain.
;DEFAULT: example.com
;mail_domain = "example.com"
;This will be combined with mail_domain and used as the source address for
;emails generated by Ampache. For example, setting this to 'me' will set the
;sender to 'me@example.com'.
;DEFAULT: info
;mail_user = "info"
;A name to go with the email address.
;DEFAULT: Ampache
;mail_name = "Ampache"
;How strictly email addresses should be checked.
;easy does a regex match, strict actually performs some SMTP transactions
;to see if we can send to this address.
;POSSIBLE VALUES: strict easy none
; DEFAULT: strict
;mail_check = "strict"
;############################
; sendmail Settings #
;############################
;DEFAULT: /usr/sbin/sendmail
;sendmail_path = "/usr/sbin/sendmail"
;#############################
; SMTP Settings #
;#############################
;Mail server (hostname or IP address)
;DEFAULT: localhost
;mail_host = "localhost"
; SMTP port
;DEFAULT: 25
;mail_port = 25
;Secure SMTP
;POSSIBLE VALUES: ssl tls
;DEFAULT: none
;mail_secure_smtp = tls
;Enable SMTP authentication
;DEFAULT: false
;mail_auth = true
;SMTP Username
;your mail auth username.
;mail_auth_user = ""
; SMTP Password
; your mail auth password.
;mail_auth_pass = ""
;#############################
; Multibyte Settings #
;#############################
; 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"

23
conf/nginx.conf Normal file
View file

@ -0,0 +1,23 @@
location PATHTOCHANGE {
alias ALIASTOCHANGE;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.php;
try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
rewrite ^PATHTOCHANGE/play/ssid/(\w+)/type/(\w+)/oid/([0-9]+)/uid/([0-9]+)/name/(.*)$ PATHTOCHANGE/play/index.php?ssid=$1&type=$2&oid=$3&uid=$4&name=$5 last;
if ( !-d $request_filename ) {
rewrite ^PATHTOCHANGE/rest/(.*)\.view$ PATHTOCHANGE/rest/index.php?action=$1 last;
}
}

35
manifest.json Normal file
View file

@ -0,0 +1,35 @@
{
"name": "Ampache",
"id": "ampache",
"description": {
"en": "A web based audio/video streaming application",
"fr": "Une application de streaming audio et vidéo"
},
"developer": {
"name": "beudbeud",
"email": "beudbeud@beudibox.fr",
"url": "http://ampache.org"
},
"multi_instance": "true",
"arguments": {
"install" : [
{
"name": "domain",
"ask": {
"en": "Choose a domain for Ampache",
"fr": "Choisissez un domaine pour Ampache"
},
"example": "domain.org"
},
{
"name": "path",
"ask": {
"en": "Choose a path for Ampache",
"fr": "Choisissez un chemin pour Ampache"
},
"example": "/ampache",
"default": "/ampache"
}
]
}
}

47
scripts/install Normal file
View file

@ -0,0 +1,47 @@
#!/bin/bash
# Retrieve arguments
domain=$1
path=$2
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a ampache
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Generate random password
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
# 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
# Copy files to the right place
final_path=/var/www/ampache
sudo mkdir -p $final_path/log
sudo cp -a ../sources/* $final_path
sudo cp ../conf/ampache.cfg.php $final_path/config/ampache.cfg.php
# Change variables in Ampache configuration
sudo sed -i "s/yunouser/$db_user/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/config/ampache.cfg.php
sudo sed -i "s/yunobase/$db_user/g" $final_path/config/ampache.cfg.php
sed -i "s@PATHTOCHANGE@$path@g" $final_path/config/ampache.cfg.php
sed -i "s@DOMAINTOCHANGE@$domain@g" $final_path/config/ampache.cfg.php
# Set permissions to roundcube directory
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
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
#sudo yunohost app setting ampache skipped_uris -v "/"
sudo yunohost app ssowatconf

10
scripts/remove Normal file
View file

@ -0,0 +1,10 @@
#!/bin/bash
db_user=ampache
db_name=ampache
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting ampache domain)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
sudo rm -rf /var/www/ampache
sudo rm -f /etc/nginx/conf.d/$domain.d/ampache.conf

142
sources/README.md Executable file
View file

@ -0,0 +1,142 @@
Ampache
=======
[www.ampache.org](http://www.ampache.org) |
[ampache.github.io](http://ampache.github.io)
Basics
------
Ampache is 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.
Ampache's usefulness is heavily dependent on being able to extract
correct metadata from embedded tags in your files and/or the filename.
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
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).
[![Build Status](https://api.travis-ci.org/ampache/ampache.png?branch=master)](https://travis-ci.org/ampache/ampache)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ampache/ampache/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/ampache/ampache/?branch=master)
Latest changes but unstable is [develop branch](https://github.com/ampache/ampache/archive/develop.tar.gz).
[![Build Status](https://api.travis-ci.org/ampache/ampache.png?branch=develop)](https://travis-ci.org/ampache/ampache)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/ampache/ampache/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/ampache/ampache/?branch=develop)
Requirements
------------
* A web server. All of the following have been used, though Apache
receives the most testing:
* Apache
* lighttpd
* nginx
* IIS
* PHP 5.3 or greater.
* PHP modules:
* PDO
* PDO_MYSQL
* hash
* session
* json
* MySQL 5.x
Installation
------------
Please see [the wiki](https://github.com/ampache/ampache/wiki/Installation)
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 file into config/. 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
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
* [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
* [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
* [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
* [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
* [Ratchet] (http://socketo.me): MIT
* [ReactPHP] (https://github.com/reactphp/react): MIT
* [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
* [MediaTable] (https://github.com/edenspiekermann/MediaTable): MIT
* [Responsive Elements] (https://github.com/kumailht/responsive-elements): MIT
* [Bootstrap] (http://getbootstrap.com): MIT
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
for more instructions.
* English (en_US)
* German (de_DE)
* Spanish (es_ES)
* Dutch (nl_NL)
* Norwegian (nb_NO)
* UK English (en_GB)
* Italian (it_IT)
* French (fr_FR)
* Swedish (sv_SE)
* Japanese (ja_JP)
* Catalan (ca_ES)
* Russian (ru_RU)
* Czech (cs_CZ)
Credits
-------
Thanks to all those who have helped make Ampache awesome: [Credits](docs/ACKNOWLEDGEMENTS)
Contact Us
----------
Hate it? Love it? Let us know. Also let us know if you think of any
more features, encounter bugs, etc.
* [Public Repository](http://github.com/ampache)
* IRC: chat.freenode.net #ampache
* [Issue Tracker](https://github.com/ampache/ampache/issues)
* [Documentation](https://github.com/ampache/ampache/wiki)

110
sources/admin/access.php Normal file
View file

@ -0,0 +1,110 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface','100')) {
UI::access_denied();
exit();
}
UI::show_header();
switch ($_REQUEST['action']) {
case 'delete_record':
if (!Core::form_verify('delete_access')) {
UI::access_denied();
exit;
}
Access::delete($_REQUEST['access_id']);
$url = AmpConfig::get('web_path') . '/admin/access.php';
show_confirmation(T_('Deleted'), T_('Your Access List Entry has been removed'),$url);
break;
case 'show_delete_record':
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&amp;access_id=' . $access->id,1,'delete_access');
break;
case 'add_host':
// Make sure we've got a valid form submission
if (!Core::form_verify('add_acl','post')) {
UI::access_denied();
exit;
}
Access::create($_POST);
// Create Additional stuff based on the type
if ($_POST['addtype'] == 'stream' ||
$_POST['addtype'] == 'all'
) {
$_POST['type'] = 'stream';
Access::create($_POST);
}
if ($_POST['addtype'] == 'all') {
$_POST['type'] = 'interface';
Access::create($_POST);
}
if (!Error::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';
}
break;
case 'update_record':
if (!Core::form_verify('edit_acl')) {
UI::access_denied();
exit;
}
$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');
} else {
$access->format();
require_once AmpConfig::get('prefix') . '/templates/show_edit_access.inc.php';
}
break;
case 'show_add_current':
case 'show_add_rpc':
case 'show_add_local':
case 'show_add_advanced':
$action = $_REQUEST['action'];
require_once AmpConfig::get('prefix') . '/templates/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';
break;
default:
$list = array();
$list = Access::get_access_lists();
require_once AmpConfig::get('prefix') .'/templates/show_access_list.inc.php';
break;
} // end switch on action
UI::show_footer();

303
sources/admin/catalog.php Normal file
View file

@ -0,0 +1,303 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
require_once AmpConfig::get('prefix') . '/modules/catalog/local.catalog.php';
if (!Access::check('interface','100')) {
UI::access_denied();
exit;
}
UI::show_header();
/* Big switch statement to handle various actions */
switch ($_REQUEST['action']) {
case 'add_to_all_catalogs':
$_REQUEST['catalogs'] = Catalog::get_catalogs();
case 'add_to_catalog':
toggle_visible('ajax-loading');
ob_end_flush();
if (AmpConfig::get('demo_mode')) { break; }
if ($_REQUEST['catalogs']) {
foreach ($_REQUEST['catalogs'] as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$catalog->add_to_catalog($_POST);
}
}
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Updated');
$body = '';
show_confirmation($title, $body, $url);
toggle_visible('ajax-loading');
break;
case 'update_all_catalogs':
$_REQUEST['catalogs'] = Catalog::get_catalogs();
case 'update_catalog':
toggle_visible('ajax-loading');
ob_end_flush();
/* If they are in demo mode stop here */
if (AmpConfig::get('demo_mode')) { break; }
if (isset($_REQUEST['catalogs'])) {
foreach ($_REQUEST['catalogs'] as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$catalog->verify_catalog();
}
}
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Updated');
$body = '';
show_confirmation($title,$body,$url);
toggle_visible('ajax-loading');
break;
case 'full_service':
toggle_visible('ajax-loading');
ob_end_flush();
/* Make sure they aren't in demo mode */
if (AmpConfig::get('demo_mode')) { UI::access_denied(); break; }
if (!$_REQUEST['catalogs']) {
$_REQUEST['catalogs'] = Catalog::get_catalogs();
}
/* This runs the clean/verify/add in that order */
foreach ($_REQUEST['catalogs'] as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$catalog->clean_catalog();
$catalog->count = 0;
$catalog->verify_catalog();
$catalog->count = 0;
$catalog->add_to_catalog();
}
Dba::optimize_tables();
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Updated');
$body = '';
show_confirmation($title,$body,$url);
toggle_visible('ajax-loading');
break;
case 'delete_catalog':
/* Make sure they aren't in demo mode */
if (AmpConfig::get('demo_mode')) { break; }
if (!Core::form_verify('delete_catalog')) {
UI::access_denied();
exit;
}
/* Delete the sucker, we don't need to check perms as thats done above */
Catalog::delete($_GET['catalog_id']);
$next_url = AmpConfig::get('web_path') . '/admin/catalog.php';
show_confirmation(T_('Catalog Deleted'), T_('The Catalog and all associated records have been deleted'),$next_url);
break;
case 'show_delete_catalog':
$catalog_id = scrub_in($_GET['catalog_id']);
$next_url = AmpConfig::get('web_path') . '/admin/catalog.php?action=delete_catalog&catalog_id=' . scrub_out($catalog_id);
show_confirmation(T_('Catalog Delete'), T_('Confirm Deletion Request'),$next_url,1,'delete_catalog');
break;
case 'enable_disabled':
if (AmpConfig::get('demo_mode')) { break; }
$songs = $_REQUEST['song'];
if (count($songs)) {
foreach ($songs as $song_id) {
Song::update_enabled(true, $song_id);
}
$body = count($songs) . ngettext(' Song Enabled', ' Songs Enabled', count($songs));
} else {
$body = T_('No Disabled Songs selected');
}
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = count($songs) . ngettext(' Disabled Song Processed', ' Disabled Songs Processed', count($songs));
show_confirmation($title,$body,$url);
break;
case 'clean_all_catalogs':
$_REQUEST['catalogs'] = Catalog::get_catalogs();
case 'clean_catalog':
toggle_visible('ajax-loading');
ob_end_flush();
/* If they are in demo mode stop them here */
if (AmpConfig::get('demo_mode')) { break; }
// Make sure they checked something
if (isset($_REQUEST['catalogs'])) {
foreach ($_REQUEST['catalogs'] as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$catalog->clean_catalog();
} // end foreach catalogs
Dba::optimize_tables();
}
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Cleaned');
$body = '';
show_confirmation($title,$body,$url);
toggle_visible('ajax-loading');
break;
case 'update_catalog_settings':
/* No Demo Here! */
if (AmpConfig::get('demo_mode')) { break; }
/* Update the catalog */
Catalog::update_settings($_POST);
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog Updated');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'update_from':
if (AmpConfig::get('demo_mode')) { break; }
// First see if we need to do an add
if ($_POST['add_path'] != '/' AND strlen($_POST['add_path'])) {
if ($catalog_id = Catalog_local::get_from_path($_POST['add_path'])) {
$catalog = Catalog::create_from_id($catalog_id);
$catalog->add_to_catalog(array('subdirectory'=>$_POST['add_path']));
}
} // end if add
// Now check for an update
if ($_POST['update_path'] != '/' AND strlen($_POST['update_path'])) {
if ($catalog_id = Catalog_local::get_from_path($_POST['update_path'])) {
$songs = Song::get_from_path($_POST['update_path']);
foreach ($songs as $song_id) { Catalog::update_single_item('song',$song_id); }
}
} // end if update
echo T_("Done.");
break;
case 'add_catalog':
/* Wah Demo! */
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'));
}
if (!strlen($_POST['name'])) {
Error::add('general', T_('Error: Name not specified'));
}
if (!Core::form_verify('add_catalog','post')) {
UI::access_denied();
exit;
}
// If an error hasn't occured
if (!Error::occurred()) {
$catalog_id = Catalog::create($_POST);
if (!$catalog_id) {
require AmpConfig::get('prefix') . '/templates/show_add_catalog.inc.php';
break;
}
$catalog = Catalog::create_from_id($catalog_id);
// Run our initial add
$catalog->add_to_catalog($_POST);
UI::show_box_top(T_('Catalog Created'), 'box box_catalog_created');
echo "<h2>" . T_('Catalog Created') . "</h2>";
Error::display('general');
Error::display('catalog_add');
UI::show_box_bottom();
show_confirmation('','', AmpConfig::get('web_path').'/admin/catalog.php');
} else {
require AmpConfig::get('prefix') . '/templates/show_add_catalog.inc.php';
}
break;
case 'clear_stats':
if (AmpConfig::get('demo_mode')) { UI::access_denied(); break; }
Stats::clear();
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Catalog statistics cleared');
$body = '';
show_confirmation($title, $body, $url);
break;
case 'show_add_catalog':
require AmpConfig::get('prefix') . '/templates/show_add_catalog.inc.php';
break;
case 'clear_now_playing':
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; }
$songs = Song::get_disabled();
if (count($songs)) {
require AmpConfig::get('prefix') . '/templates/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; }
$catalog = Catalog::create_from_id($_REQUEST['catalog_id']);
$nexturl = AmpConfig::get('web_path') . '/admin/catalog.php?action=delete_catalog&amp;catalog_id=' . scrub_out($_REQUEST['catalog_id']);
show_confirmation(T_('Delete Catalog'), T_('Do you really want to delete this catalog?') . " -- $catalog->name ($catalog->path)",$nexturl,1);
break;
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';
break;
case 'gather_album_art':
toggle_visible('ajax-loading');
ob_end_flush();
$catalogs = $_REQUEST['catalogs'] ? $_REQUEST['catalogs'] : Catalog::get_catalogs();
// Iterate throught the catalogs and gather as needed
foreach ($catalogs as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
require AmpConfig::get('prefix') . '/templates/show_gather_art.inc.php';
flush();
$catalog->gather_art();
}
$url = AmpConfig::get('web_path') . '/admin/catalog.php';
$title = T_('Album Art Search Finished');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'show_catalogs':
default:
require_once AmpConfig::get('prefix') . '/templates/show_manage_catalogs.inc.php';
break;
} // end switch
/* Show the Footer */
UI::show_footer();

View file

@ -0,0 +1,45 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface','100')) {
UI::access_denied();
exit;
}
UI::show_header();
/* Switch on Action */
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';
break;
default:
require_once AmpConfig::get('prefix') . '/templates/show_duplicate.inc.php';
break;
} // end switch on action
UI::show_footer();

72
sources/admin/export.php Normal file
View file

@ -0,0 +1,72 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface','100')) {
UI::access_denied();
exit;
}
UI::show_header();
/* Switch on Action */
switch ($_REQUEST['action']) {
case 'export':
// This may take a while
set_time_limit(0);
// Clear everything we've done so far
ob_end_clean();
// This will disable buffering so contents are sent immediately to browser.
// This is very useful for large catalogs because it will immediately display the download dialog to user,
// instead of waiting until contents are generated, which could take a long time.
ob_implicit_flush(true);
header("Content-Transfer-Encoding: binary");
header("Cache-control: public");
$date = date("d/m/Y",time());
switch ($_REQUEST['export_format']) {
case 'itunes':
header("Content-Type: application/itunes+xml; charset=utf-8");
header("Content-Disposition: attachment; filename=\"ampache-itunes-$date.xml\"");
Catalog::export('itunes', $_REQUEST['export_catalog']);
break;
case 'csv':
header("Content-Type: application/vnd.ms-excel");
header("Content-Disposition: filename=\"ampache-export-$date.csv\"");
Catalog::export('csv', $_REQUEST['export_catalog']);
break;
} // end switch on format
// We don't want the footer so we're done here
exit;
default:
require_once AmpConfig::get('prefix') . '/templates/show_export.inc.php';
break;
} // end switch on action
UI::show_footer();

45
sources/admin/index.php Normal file
View file

@ -0,0 +1,45 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface',100)) {
UI::access_denied();
exit();
}
UI::show_header();
switch ($_REQUEST['action']) {
default:
// Show Catalogs
$catalog_ids = Catalog::get_catalogs();
$browse = new Browse();
$browse->set_type('catalog');
$browse->set_static_content(true);
$browse->save_objects($catalog_ids);
$browse->show_objects($catalog_ids);
$browse->store();
break;
}
UI::show_footer();

75
sources/admin/mail.php Normal file
View file

@ -0,0 +1,75 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface','75')) {
UI::access_denied();
exit();
}
UI::show_header();
// Action switch
switch ($_REQUEST['action']) {
case 'send_mail':
if (AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
// Multi-byte Character Mail
if (function_exists('mb_language')) {
ini_set("mbstring.internal_encoding","UTF-8");
mb_language("uni");
}
$mailer = new Mailer();
// Set the vars on the object
$mailer->subject = $_REQUEST['subject'];
$mailer->message = $_REQUEST['message'];
if ($_REQUEST['from'] == 'system') {
$mailer->set_default_sender();
} else {
$mailer->sender = $GLOBALS['user']->email;
$mailer->sender_name = $GLOBALS['user']->fullname;
}
if ($mailer->send_to_group($_REQUEST['to'])) {
$title = T_('E-mail Sent');
$body = T_('Your E-mail was successfully sent.');
} else {
$title = T_('E-mail Not Sent');
$body = T_('Your E-mail was not sent.');
}
$url = AmpConfig::get('web_path') . '/admin/mail.php';
show_confirmation($title,$body,$url);
break;
default:
require_once AmpConfig::get('prefix') . '/templates/show_mail_users.inc.php';
break;
} // end switch
UI::show_footer();

203
sources/admin/modules.php Normal file
View file

@ -0,0 +1,203 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!$GLOBALS['user']->has_access(100)) {
UI::access_denied();
exit();
}
/* Always show the header */
UI::show_header();
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');
break;
}
// Install it!
$localplay->install();
// Go ahead and enable Localplay (Admin->System) as we assume they want to do that
// if they are enabling this
Preference::update('allow_localplay_playback','-1','1');
Preference::update('localplay_level',$GLOBALS['user']->id,'100');
Preference::update('localplay_controller',$GLOBALS['user']->id,$localplay->type);
header("Location:" . AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay');
break;
case 'install_catalog_type':
$type = scrub_in($_REQUEST['type']);
$catalog = Catalog::create_catalog_type($type);
if ($catalog == null) {
Error::add('general', T_('Install Failed, Catalog Error'));
Error::display('general');
break;
}
$catalog->install();
/* Show Confirmation */
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_catalog_types';
$title = T_('Plugin Installed');
$body = '';
show_confirmation($title ,$body, $url);
break;
case 'confirm_uninstall_localplay':
$type = scrub_in($_REQUEST['type']);
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_localplay&amp;type=' . $type;
$title = T_('Are you sure you want to remove this plugin?');
$body = '';
show_confirmation($title,$body,$url,1);
break;
case 'confirm_uninstall_catalog_type':
$type = scrub_in($_REQUEST['type']);
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_catalog_type&amp;type=' . $type;
$title = T_('Are you sure you want to remove this plugin?');
$body = '';
show_confirmation($title,$body,$url,1);
break;
case 'uninstall_localplay':
$type = scrub_in($_REQUEST['type']);
$localplay = new Localplay($type);
$localplay->uninstall();
/* Show Confirmation */
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_localplay';
$title = T_('Plugin Deactivated');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'uninstall_catalog_type':
$type = scrub_in($_REQUEST['type']);
$catalog = Catalog::create_catalog_type($type);
if ($catalog == null) {
Error::add('general', T_('Uninstall Failed, Catalog Error'));
Error::display('general');
break;
}
$catalog->uninstall();
/* Show Confirmation */
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_catalog_types';
$title = T_('Plugin Deactivated');
$body = '';
show_confirmation($title, $body, $url);
break;
case 'install_plugin':
/* Verify that this plugin exists */
$plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'],$plugins)) {
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1');
break;
}
$plugin = new Plugin($_REQUEST['plugin']);
if (!$plugin->install()) {
debug_event('plugins','Error: Plugin Install Failed, ' . $_REQUEST['plugin'],'1');
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Unable to Install Plugin');
$body = '';
show_confirmation($title,$body,$url);
break;
}
// Don't trust the plugin to this stuff
User::rebuild_all_preferences();
/* Show Confirmation */
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Plugin Activated');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'confirm_uninstall_plugin':
$plugin = scrub_in($_REQUEST['plugin']);
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=uninstall_plugin&amp;plugin=' . $plugin;
$title = T_('Are you sure you want to remove this plugin?');
$body = '';
show_confirmation($title,$body,$url,1);
break;
case 'uninstall_plugin':
/* Verify that this plugin exists */
$plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'],$plugins)) {
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1');
break;
}
$plugin = new Plugin($_REQUEST['plugin']);
$plugin->uninstall();
// Don't trust the plugin to do it
User::rebuild_all_preferences();
/* Show Confirmation */
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Plugin Deactivated');
$body = '';
show_confirmation($title,$body,$url);
break;
case 'upgrade_plugin':
/* Verify that this plugin exists */
$plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'],$plugins)) {
debug_event('plugins','Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected','1');
break;
}
$plugin = new Plugin($_REQUEST['plugin']);
$plugin->upgrade();
User::rebuild_all_preferences();
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Plugin Upgraded');
$body = '';
show_confirmation($title, $body, $url);
break;
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';
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';
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';
UI::show_box_bottom();
break;
default:
// Rien a faire
break;
} // end switch
UI::show_footer();

61
sources/admin/shout.php Normal file
View file

@ -0,0 +1,61 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface','100')) {
UI::access_denied();
exit;
}
UI::show_header();
// Switch on the incomming action
switch ($_REQUEST['action']) {
case 'edit_shout':
$shout_id = $_POST['shout_id'];
$update = Shoutbox::update($_POST);
show_confirmation(T_('Shoutbox Post Updated'),'',AmpConfig::get('web_path').'/admin/shout.php');
break;
case 'show_edit':
$shout = new Shoutbox($_REQUEST['shout_id']);
$object = Shoutbox::get_object($shout->object_type,$shout->object_id);
$object->format();
$client = new User($shout->user);
$client->format();
require_once AmpConfig::get('prefix') . '/templates/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');
break;
default:
$browse = new Browse();
$browse->set_type('shoutbox');
$browse->set_simple_browse(true);
$shoutbox_ids = $browse->get_objects();
$browse->show_objects($shoutbox_ids);
$browse->store();
break;
} // end switch on action
UI::show_footer();

61
sources/admin/system.php Normal file
View file

@ -0,0 +1,61 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface',100) OR AmpConfig::get('demo_mode')) {
UI::access_denied();
exit();
}
UI::show_header();
/* Switch on action boys */
switch ($_REQUEST['action']) {
/* This re-generates the config file comparing
* /config/ampache.cfg to .cfg.dist
*/
case 'generate_config':
ob_end_clean();
$current = parse_ini_file(AmpConfig::get('prefix') . '/config/ampache.cfg.php');
$final = generate_config($current);
$browser = new Horde_Browser();
$browser->downloadHeaders('ampache.cfg.php','text/plain',false,filesize(AmpConfig::get('prefix') . '/config/ampache.cfg.php.dist'));
echo $final;
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');
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';
break;
default:
// Rien a faire
break;
} // end switch
UI::show_footer();

251
sources/admin/users.php Normal file
View file

@ -0,0 +1,251 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once '../lib/init.php';
if (!Access::check('interface','100')) {
UI::access_denied();
exit();
}
UI::show_header();
// Switch on the actions
switch ($_REQUEST['action']) {
case 'update_user':
if (AmpConfig::get('demo_mode')) { break; }
if (!Core::form_verify('edit_user','post')) {
UI::access_denied();
exit;
}
/* Clean up the variables */
$user_id = intval($_POST['user_id']);
$username = scrub_in($_POST['username']);
$fullname = scrub_in($_POST['fullname']);
$email = scrub_in($_POST['email']);
$website = scrub_in($_POST['website']);
$access = scrub_in($_POST['access']);
$pass1 = $_POST['password_1'];
$pass2 = $_POST['password_2'];
/* Setup the temp user */
$client = new User($user_id);
/* Verify Input */
if (empty($username)) {
Error::add('username', T_("Error Username Required"));
}
if ($pass1 !== $pass2 && !empty($pass1)) {
Error::add('password', T_("Error Passwords don't match"));
}
/* If we've got an error then break! */
if (Error::occurred()) {
$_REQUEST['action'] = 'show_edit';
break;
} // if we've had an oops!
if ($access != $client->access) {
$client->update_access($access);
}
if ($email != $client->email) {
$client->update_email($email);
}
if ($website != $client->website) {
$client->update_website($website);
}
if ($username != $client->username) {
$client->update_username($username);
}
if ($fullname != $client->fullname) {
$client->update_fullname($fullname);
}
if ($pass1 == $pass2 && strlen($pass1)) {
$client->update_password($pass1);
}
$client->upload_avatar();
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 (!Core::form_verify('add_user','post')) {
UI::access_denied();
exit;
}
$username = scrub_in($_POST['username']);
$fullname = scrub_in($_POST['fullname']);
$email = scrub_in($_POST['email']);
$website = scrub_in($_POST['website']);
$access = scrub_in($_POST['access']);
$pass1 = $_POST['password_1'];
$pass2 = $_POST['password_2'];
if ($pass1 !== $pass2 || !strlen($pass1)) {
Error::add('password', T_("Error Passwords don't match"));
}
if (empty($username)) {
Error::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'));
}
if (!Error::occurred()) {
/* Attempt to create the user */
$user_id = User::create($username, $fullname, $email, $website, $pass1, $access);
if (!$user_id) {
Error::add('general', T_("Error: Insert Failed"));
}
$user = new User($user_id);
$user->upload_avatar();
} // if no errors
else {
$_REQUEST['action'] = 'show_add_user';
break;
}
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');
break;
case 'enable':
$client = new User($_REQUEST['user_id']);
$client->enable();
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');
} else {
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; }
$client = new User($_REQUEST['user_id']);
require_once AmpConfig::get('prefix') . '/templates/show_edit_user.inc.php';
break;
case 'confirm_delete':
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");
} else {
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; }
$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&amp;user_id=" . $_REQUEST['user_id'],1,'delete_user');
break;
case 'show_delete_avatar':
$user_id = $_REQUEST['user_id'];
$next_url = AmpConfig::get('web_path') . '/admin/users.php?action=delete_avatar&user_id=' . scrub_out($user_id);
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 (!Core::form_verify('delete_avatar','post')) {
UI::access_denied();
exit;
}
$client = new User($_REQUEST['user_id']);
$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);
break;
case 'show_generate_apikey':
$user_id = $_REQUEST['user_id'];
$next_url = AmpConfig::get('web_path') . '/admin/users.php?action=generate_apikey&user_id=' . scrub_out($user_id);
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 (!Core::form_verify('generate_apikey','post')) {
UI::access_denied();
exit;
}
$client = new User($_REQUEST['user_id']);
$client->generate_apikey();
$next_url = AmpConfig::get('web_path') . '/admin/users.php';
show_confirmation(T_('API Key Generated'), T_('New user API Key has been generated.'), $next_url);
break;
/* Show IP History for the Specified User */
case 'show_ip_history':
/* get the user and their history */
$working_user = new User($_REQUEST['user_id']);
if (!isset($_REQUEST['all'])) {
$history = $working_user->get_ip_history(0,1);
} else {
$history = $working_user->get_ip_history();
}
require AmpConfig::get('prefix') . '/templates/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';
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';
break;
default:
$browse = new Browse();
$browse->reset_filters();
$browse->set_type('user');
$browse->set_simple_browse(1);
$browse->set_sort('name','ASC');
$user_ids = $browse->get_objects();
$browse->show_objects($user_ids);
$browse->store();
break;
} // end switch on action
/* Show the footer */
UI::show_footer();

239
sources/albums.php Normal file
View file

@ -0,0 +1,239 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
require_once AmpConfig::get('prefix') . '/templates/header.inc.php';
/* Switch on Action */
switch ($_REQUEST['action']) {
case 'clear_art':
if (!$GLOBALS['user']->has_access('75')) { UI::access_denied(); }
$art = new Art($_GET['album_id'],'album');
$art->reset();
show_confirmation(T_('Album Art Cleared'), T_('Album Art information has been removed from the database'),"/albums.php?action=show&amp;album=" . $art->uid);
break;
// Upload album art
case 'upload_art':
// we didn't find anything
if (empty($_FILES['file']['tmp_name'])) {
show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&amp;album=" . $_REQUEST['album_id']);
break;
}
$album = new Album($_REQUEST['album_id']);
// Pull the image information
$data = array('file'=>$_FILES['file']['tmp_name']);
$image_data = Art::get_from_source($data, 'album');
// If we got something back insert it
if ($image_data) {
$art = new Art($album->id,'album');
$art->insert($image_data,$_FILES['file']['type']);
show_confirmation(T_('Album Art Inserted'),'',"/albums.php?action=show&amp;album=" . $album->id);
}
// Else it failed
else {
show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&amp;album=" . $album->id);
}
break;
case 'find_art':
// If not a user then kick em out
if (!Access::check('interface','25')) { UI::access_denied(); exit; }
// Prevent the script from timing out
set_time_limit(0);
// get the Album information
$album = new Album($_GET['album_id']);
$album->format();
$art = new Art($album->id,'album');
$images = array();
$cover_url = array();
// If we've got an upload ignore the rest and just insert it
if (!empty($_FILES['file']['tmp_name'])) {
$path_info = pathinfo($_FILES['file']['name']);
$upload['file'] = $_FILES['file']['tmp_name'];
$upload['mime'] = 'image/' . $path_info['extension'];
$image_data = Art::get_from_source($upload, 'album');
if ($image_data) {
$art->insert($image_data,$upload['0']['mime']);
show_confirmation(T_('Album Art Inserted'),'',"/albums.php?action=show&amp;album=" . $_REQUEST['album_id']);
break;
} // if image data
} // if it's an upload
// Build the options for our search
if (isset($_REQUEST['artist_name'])) {
$artist = scrub_in($_REQUEST['artist_name']);
} elseif ($album->artist_count == '1') {
$artist = $album->f_artist_name;
} else {
$artist = "";
}
if (isset($_REQUEST['album_name'])) {
$album_name = scrub_in($_REQUEST['album_name']);
} else {
$album_name = $album->full_name;
}
$options['artist'] = $artist;
$options['album_name'] = $album_name;
$options['keyword'] = trim($artist . " " . $album_name);
// Attempt to find the art.
$images = $art->gather($options);
if (!empty($_REQUEST['cover'])) {
$path_info = pathinfo($_REQUEST['cover']);
$cover_url[0]['url'] = scrub_in($_REQUEST['cover']);
$cover_url[0]['mime'] = 'image/' . $path_info['extension'];
}
$images = array_merge($cover_url,$images);
// If we've found anything then go for it!
if (count($images)) {
// We don't want to store raw's in here so we need to strip them out into a separate array
foreach ($images as $index=>$image) {
if ($image['raw']) {
unset($images[$index]['raw']);
}
} // end foreach
// Store the results for further use
$_SESSION['form']['images'] = $images;
require_once AmpConfig::get('prefix') . '/templates/show_album_art.inc.php';
}
// Else nothing
else {
show_confirmation(T_('Album Art Not Located'), T_('Album Art could not be located at this time. This may be due to write access error, or the file is not received correctly.'),"/albums.php?action=show&amp;album=" . $album->id);
}
$albumname = $album->name;
$artistname = $artist;
// Remember the last typed entry, if there was one
if (!empty($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); }
if (!empty($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); }
require_once AmpConfig::get('prefix') . '/templates/show_get_albumart.inc.php';
break;
case 'select_art':
/* Check to see if we have the image url still */
$image_id = $_REQUEST['image'];
$album_id = $_REQUEST['album_id'];
// Prevent the script from timing out
set_time_limit(0);
$album = new Album($album_id);
$album_groups = $album->get_group_disks_ids();
$image = Art::get_from_source($_SESSION['form']['images'][$image_id], 'album');
$mime = $_SESSION['form']['images'][$image_id]['mime'];
foreach ($album_groups as $a_id) {
$art = new Art($a_id, 'album');
$art->insert($image, $mime);
}
header("Location:" . AmpConfig::get('web_path') . "/albums.php?action=show&album=" . $album_id);
break;
case 'update_from_tags':
// Make sure they are a 'power' user at least
if (!Access::check('interface','75')) {
UI::access_denied();
exit;
}
$type = 'album';
$object_id = intval($_REQUEST['album_id']);
$target_url = AmpConfig::get('web_path') . '/albums.php?action=show&amp;album=' . $object_id;
require_once AmpConfig::get('prefix') . '/templates/show_update_items.inc.php';
break;
case 'set_track_numbers':
debug_event('albums', 'Set track numbers called.', '5');
if (!Access::check('interface','75')) {
UI::access_denied();
exit;
}
// Retrieving final song order from url
foreach ($_GET as $key => $data) {
$_GET[$key] = unhtmlentities(scrub_in($data));
debug_event('albums', $key.'='.$_GET[$key], '5');
}
if (isset($_GET['order'])) {
$songs = explode(";", $_GET['order']);
$track = 1;
foreach ($songs as $song_id) {
if ($song_id != '') {
Song::update_track($track, $song_id);
++$track;
}
}
}
break;
case 'show_missing':
set_time_limit(600);
$mbid = $_REQUEST['mbid'];
$walbum = new Wanted(Wanted::get_wanted($mbid));
if (!$walbum->id) {
$walbum->mbid = $mbid;
if (isset($_REQUEST['artist'])) {
$artist = new Artist($_REQUEST['artist']);
$walbum->artist = $artist->id;
$walbum->artist_mbid = $artist->mbid;
} elseif (isset($_REQUEST['artist_mbid'])) {
$walbum->artist_mbid = $_REQUEST['artist_mbid'];
}
}
$walbum->load_all();
$walbum->format();
require AmpConfig::get('prefix') . '/templates/show_missing_album.inc.php';
break;
// Browse by Album
case 'show':
default:
$album = new Album($_REQUEST['album']);
$album->format();
if (!count($album->album_suite)) {
require AmpConfig::get('prefix') . '/templates/show_album.inc.php';
} else {
require AmpConfig::get('prefix') . '/templates/show_album_group_disks.inc.php';
}
break;
} // switch on view
UI::show_footer();

83
sources/artists.php Normal file
View file

@ -0,0 +1,83 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
UI::show_header();
/**
* Display Switch
*/
switch ($_REQUEST['action']) {
case 'show':
$artist = new Artist($_REQUEST['artist']);
$artist->format();
$object_ids = $artist->get_albums($_REQUEST['catalog']);
$object_type = 'album';
require_once AmpConfig::get('prefix') . '/templates/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';
break;
case 'update_from_tags':
$type = 'artist';
$object_id = intval($_REQUEST['artist']);
$target_url = AmpConfig::get('web_path') . "/artists.php?action=show&amp;artist=" . $object_id;
require_once AmpConfig::get('prefix') . '/templates/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; }
/* Enclose this in the purty box! */
require AmpConfig::get('prefix') . '/templates/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';
if ($match === "Browse") {
show_artists();
} elseif ($match === "Show_all") {
$offset_limit = 999999;
show_artists();
} else {
if ($chr == '') {
show_artists('A');
} else {
show_artists($chr);
}
}
break;
case 'show_missing':
set_time_limit(600);
$mbid = $_REQUEST['mbid'];
$wartist = Wanted::get_missing_artist($mbid);
require AmpConfig::get('prefix') . '/templates/show_missing_artist.inc.php';
break;
} // end switch
UI::show_footer();

108
sources/batch.php Normal file
View file

@ -0,0 +1,108 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
if (!defined('NO_SESSION')) {
require_once 'lib/init.php';
}
ob_end_clean();
//test that batch download is permitted
if (!defined('NO_SESSION') && !Access::check_function('batch_download')) {
UI::access_denied();
exit;
}
/* Drop the normal Time limit constraints, this can take a while */
set_time_limit(0);
$media_ids = array();
$name = "Unknown.zip";
switch ($_REQUEST['action']) {
case 'tmp_playlist':
$media_ids = $GLOBALS['user']->playlist->get_items();
$name = $GLOBALS['user']->username . ' - Playlist';
break;
case 'playlist':
$playlist = new Playlist($_REQUEST['id']);
$media_ids = $playlist->get_songs();
$name = $playlist->name;
break;
case 'smartplaylist':
$search = new Search('song', $_REQUEST['id']);
$sql = $search->to_sql();
$sql = $sql['base'] . ' ' . $sql['table_sql'] . ' WHERE ' .
$sql['where_sql'];
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$media_ids[] = $row['id'];
}
$name = $search->name;
break;
case 'album':
foreach ($_REQUEST['id'] as $a) {
$album = new Album($a);
if (empty($name)) {
$name = $album->name;
}
$asongs = $album->get_songs();
foreach ($asongs as $song_id) {
$media_ids[] = $song_id;
}
}
break;
case 'artist':
$artist = new Artist($_REQUEST['id']);
$media_ids = $artist->get_songs();
$name = $artist->name;
break;
case 'browse':
$id = scrub_in($_REQUEST['browse_id']);
$browse = new Browse($id);
$browse_media_ids = $browse->get_saved();
foreach ($browse_media_ids as $media_id) {
switch ($_REQUEST['type']) {
case 'album':
$album = new Album($media_id);
$media_ids = array_merge($media_ids, $album->get_songs());
break;
case 'song':
$media_ids[] = $media_id;
break;
case 'video':
$media_ids[] = array('Video', $media_id);
break;
} // switch on type
} // foreach media_id
$name = 'Batch-' . date("dmY",time());
default:
// Rien a faire
break;
} // action switch
// Take whatever we've got and send the zip
$song_files = get_song_files($media_ids);
if (is_array($song_files['0'])) {
set_memory_limit($song_files['1']+32);
send_zip($name,$song_files['0']);
}
exit;

2
sources/bin/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order deny,allow
Deny from all

View file

@ -0,0 +1,177 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
define('CLI', 1);
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
ob_end_flush();
$catclean = 0; //All off by default
$catverify = 0;
$catadd = 0;
$artadd = 0;
$plimp = 0;
if (count($_SERVER['argv']) == 1) {
$operations_string = "\n\t". T_('- All Catalog Operations');
}
if (count($_SERVER['argv']) > 1) {
for ($x = 1; $x < count($_SERVER['argv']); $x++) {
if ($_SERVER['argv'][$x] == "-c") {
$operations_string .= "\n\t" . T_('- Catalog Clean');
$catclean = 1;
}
elseif ($_SERVER['argv'][$x] == "-v") {
$operations_string .= "\n\t" . T_('- Catalog Verify');
$catverify = 1;
}
elseif ($_SERVER['argv'][$x] == "-a") {
$operations_string .= "\n\t" . T_('- Catalog Add');
$catadd = 1;
}
elseif ($_SERVER['argv'][$x] == "-g") {
$operations_string .= "\n\t" . T_('- Catalog Art Gather');
$artadd = 1;
}
elseif ($_SERVER['argv'][$x] == "-i") {
$operations_string .= "\n\t" . T_('- Playlist Import');
$plimp = 1;
}
else {
if ($where) $where .= " OR ";
$where .= "name LIKE '%" . Dba::escape(preg_replace("/[^a-z0-9\. -]/i", "", $_SERVER['argv'][$x])) . "%'";
}
}
}
if (count($_SERVER['argv']) != 1 AND $artadd != 1 && $catclean != 1 && $catverify != 1 && $catadd != 1) {
usage();
exit;
}
if ($artadd == 0 && $catclean == 0 && $catverify == 0 && $catadd == 0) { //didn't pass any clean/verify/add arguments
$catclean = 1; //set them all to on
$catverify = 1;
$catadd = 1;
$artadd = 1;
}
echo T_("Starting Catalog Operations...") . $operations_string . "\n";
if ($where) $where = "($where) AND catalog_type='local'";
else $where = "catalog_type='local'";
$sql = "SELECT id FROM catalog";
if ($where) $sql .= " WHERE $where";
$db_results = Dba::read($sql);
ob_start("ob_html_strip",'1024',true);
while ($row = Dba::fetch_row($db_results)) {
$catalog = Catalog::create_from_id($row['0']);
printf(T_('Reading: %s'), $catalog->name);
ob_flush();
echo "\n";
if ($catclean == 1) {
// Clean out dead files
echo T_("- Starting Clean - ");
echo "\n";
$catalog->clean_catalog();
echo "------------------\n\n";
}
if ($catverify == 1) {
// Verify Existing
echo T_("- Starting Verify - ");
echo "\n";
$catalog->verify_catalog($row['0']);
echo "-------------------\n\n";
}
if ($catadd == 1) {
// Look for new files
echo T_("- Starting Add - ");
echo "\n";
$options = array();
if ($artadd == 1) {
$options['gather_art'] = true;
}
if ($plimp == 1) {
$options['parse_playlist'] = true;
}
$catalog->add_to_catalog($options);
echo "----------------\n\n";
} elseif ($artadd == 1) {
// Look for album art
echo T_('Starting Album Art Search');
echo "\n";
$catalog->gather_art();
echo "----------------\n\n";
}
}
Dba::optimize_tables();
ob_end_flush();
echo "\n";
function ob_html_strip($string) {
//$string = preg_replace("/update_txt\('.+'\);update_txt\('(.+)','.+'\);/","$1",$string);
//$string = preg_replace("/update_.+/","",$string);
$string = str_replace('<br />', "\n", $string);
$string = strip_tags($string);
$string = html_entity_decode($string);
$string = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/","\n",$string);
$string = trim($string);
return $string;
} // ob_html_strip
function usage() {
echo T_("- Catalog Update -");
echo "\n";
echo T_("Usage: catalog_update.inc [CATALOG NAME] [-c|-v|-a|-g|-t|-i]");
echo "\n\t";
echo T_("Default behavior is to do all except playlist import");
echo "\n-c\t";
echo T_('Clean Catalogs');
echo "\n-v\t";
echo T_('Verify Catalogs');
echo "\n-a\t";
echo T_('Add to Catalogs');
echo "\n-i\t";
echo T_('Import Playlists');
echo "\n-g\t";
echo T_('Gather Art');
echo "\n";
echo "----------------------------------------------------------";
echo "\n";
}
?>

489
sources/bin/channel_run.inc Normal file
View file

@ -0,0 +1,489 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
define('CLI', 1);
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
ob_end_flush();
$metadata_interval = 16000;
$start_date = time();
$verbose = false;
$port = 0;
$chanid = 0;
$cargv = count($_SERVER['argv']);
if ($cargv > 1) {
for ($x = 1; $x < $cargv; $x++) {
if ($_SERVER['argv'][$x] == "-c" && ($x + 1) < $cargv) {
$chanid = intval($_SERVER['argv'][++$x]);
$operations_string .= "\n\t" . T_('- Channel ' . $chanid);
}
elseif ($_SERVER['argv'][$x] == "-v") {
$operations_string .= "\n\t" . T_('- Verbose');
$verbose = true;
}
elseif ($_SERVER['argv'][$x] == "-p" && ($x + 1) < $cargv) {
$port = intval($_SERVER['argv'][++$x]);
$operations_string .= "\n\t" . T_('- Port ' . $port);
}
}
}
if ($chanid <= 0) {
usage();
exit;
}
// Transcode is mandatory to have consistent stream codec
$transcode_cfg = AmpConfig::get('transcode');
if ($transcode_cfg == 'never') {
die('Cannot start channel, transcoding is mandatory to work.');
}
echo T_("Starting Channel...") . $operations_string . "\n";
$channel = new Channel($chanid);
if (!$channel->id) {
die (T_("Unknown channel."));
}
if ($port <= 0) {
if ($channel->fixed_endpoint) {
$address = $channel->interface;
$port = $channel->port;
} else {
$address = "127.0.0.1";
// Try to find an available port
for ($p = 8200; $p < 8300; ++$p) {
$connection = @fsockopen($address, $p);
if (is_resource($connection)) {
fclose($connection);
} else {
echo T_("Found available port ") . $p . "\n";
$port = $p;
break;
}
}
}
}
ob_start();
$server_uri = 'tcp://' . $address . ':' . $port;
$server = stream_socket_server($server_uri, $errno, $errorMessage);
if ($server === false)
{
die("Could not bind to socket: " . $errorMessage);
}
$channel->update_start($start_date, $address, $port, getmypid());
echo T_("Listening on ") . $address . ':' . $port . "\n";
$stream_clients = array();
$client_socks = array();
$last_stream = 0;
while(true)
{
//prepare readable sockets
$read_socks = $client_socks;
if (count($client_socks) < $channel->max_listeners) {
$read_socks[] = $server;
}
//echo "b\n";ob_flush();
//start reading and use a large timeout
if(stream_select ( $read_socks, $write, $except, 1))
{
//new client
if (in_array($server, $read_socks))
{
$new_client = stream_socket_accept($server);
if ($new_client)
{
debug_event('channel', 'Connection accepted from ' . stream_socket_get_name($new_client, true) . '.', '5');
$client_socks[] = $new_client;
$channel->update_listeners(count($client_socks), true);
debug_event('channel', 'Now there are total '. count($client_socks) . ' clients.', '5');
echo "New client connected.\n";
ob_flush();
}
//delete the server socket from the read sockets
unset($read_socks[array_search($server, $read_socks)]);
}
// Get new message from existing client
foreach($read_socks as $sock)
{
$data = fread($sock, 1024);
if(!$data)
{
client_disconnect($channel, $client_socks, $stream_clients, $sock);
continue;
}
$headers = explode("\n", $data);
if (count($headers) > 0) {
$cmd = explode(" ", $headers[0]);
if ($cmd['0'] == 'GET') {
switch ($cmd['1']) {
case '/stream.' . $channel->stream_type:
$options = array(
'socket' => $sock,
'length' => 0
);
for ($i = 1; $i < count($headers); $i++) {
$headerpart = explode(":", $headers[$i], 2);
$header = strtolower(trim($headerpart[0]));
$value = trim($headerpart[1]);
switch ($header) {
case 'icy-metadata':
$options['metadata'] = ($value == '1');
$options['metadata_lastsent'] = 0;
$options['metadata_lastsong'] = 0;
break;
}
}
// Stream request
if ($options['metadata']) {
//fwrite($sock, "ICY 200 OK\r\n");
fwrite($sock, "HTTP/1.0 200 OK\r\n");
} else {
fwrite($sock, "HTTP/1.1 200 OK\r\n");
fwrite($sock, "Cache-Control: no-store, no-cache, must-revalidate\r\n");
}
fwrite($sock, "Content-Type: " . Song::type_to_mime($transcode_to) . "\r\n");
fwrite($sock, "Accept-Ranges: none\r\n");
$genre = $channel->get_genre();
// Send Shoutcast metadata on demand
if ($options['metadata']) {
fwrite($sock, "icy-notice1: " . AmpConfig::get('title') . "\r\n");
fwrite($sock, "icy-name: " . $channel->name . "\r\n");
if (!empty($genre)) {
fwrite($sock, "icy-genre: " . $genre . "\r\n");
}
fwrite($sock, "icy-url: " . $channel->url . "\r\n");
fwrite($sock, "icy-pub: " . ($channel->is_private) ? '0' : '1' . "\r\n");
if ($channel->bitrate) {
fwrite($sock, "icy-br: " . strval($channel->bitrate) . "\r\n");
}
fwrite($sock, "icy-metaint: " . strval($metadata_interval) . "\r\n");
}
// Send additional Icecast metadata
fwrite($sock, "x-audiocast-server-url: " . $channel->url . "\r\n");
fwrite($sock, "x-audiocast-name: " . $channel->name . "\r\n");
fwrite($sock, "x-audiocast-description: " . $channel->description . "\r\n");
fwrite($sock, "x-audiocast-url: " . $channel->url . "\r\n");
if (!empty($genre)) {
fwrite($sock, "x-audiocast-genre: " . $genre . "\r\n");
}
fwrite($sock, "x-audiocast-bitrate: " . strval($channel->bitrate) . "\r\n");
fwrite($sock, "x-audiocast-public: " . (($channel->is_private) ? "0" : "1") . "\r\n");
fwrite($sock, "\r\n");
// Add to stream clients list
$key = array_search($sock, $read_socks);
$stream_clients[$key] = $options;
break;
case '/':
case '/status.xsl':
// Stream request
fwrite($sock, "HTTP/1.0 200 OK\r\n");
fwrite($sock, "Cache-Control: no-store, no-cache, must-revalidate\r\n");
fwrite($sock, "Content-Type: text/html\r\n");
fwrite($sock, "\r\n");
// Create xsl structure
// Header
$xsl = "";
$xsl .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" . "\n";
$xsl .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" . "\n";
$xsl .= "<html xmlns=\"http://www.w3.org/1999/xhtml\">" . "\n";
$xsl .= "<head>" . "\n";
$xsl .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" . "\n";
$xsl .= "<title>Icecast Streaming Media Server - Ampache</title>" . "\n";
$xsl .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" . "\n";
$xsl .= "</head>" . "\n";
$xsl .= "<body>" . "\n";
$xsl .= "<div class=\"main\">" . "\n";
// Content
$xsl .= "<div class=\"roundcont\">" . "\n";
$xsl .= "<div class=\"roundtop\">" . "\n";
$xsl .= "<img src=\"images/corner_topleft.jpg\" class=\"corner\" style=\"display: none\" alt=\"\" />" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "<div class=\"newscontent\">" . "\n";
$xsl .= "<div class=\"streamheader\">" . "\n";
$xsl .= "<table cellspacing=\"0\" cellpadding=\"0\">" . "\n";
$xsl .= "<colgroup align=\"left\"></colgroup>" . "\n";
$xsl .= "<colgroup align=\"right\" width=\"300\"></colgroup>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td><h3>Mount Point /stream." . $channel->stream_type . "</h3></td>" . "\n";
$xsl .= "<td align=\"right\">" . "\n";
$xsl .= "<a href=\"stream.". $channel->stream_type .".m3u\">M3U</a>" . "\n";
$xsl .= "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "</table>" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "<table border=\"0\" cellpadding=\"4\">" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Stream Title:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $channel->name . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Stream Description:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $channel->description . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Content Type:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . Song::type_to_mime($channel->stream_type) . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Mount Start:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . date("c", $channel->start_date) . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Bitrate:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $channel->bitrate . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Current Listeners:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $channel->listeners . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Peak Listeners:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $channel->peak_listeners . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$genre = $channel->get_genre();
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Stream Genre:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $genre . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Stream URL:</td>" . "\n";
$xsl .= "<td class=\"streamdata\"><a href=\"" . $channel->url . "\" target=\"_blank\">" . $channel->url . "</a></td>" . "\n";
$xsl .= "</tr>" . "\n";
$currentsong = "";
if ($channel->media) {
$currentsong = $channel->media->f_artist . " - " . $channel->media->f_title;
}
$xsl .= "<tr>" . "\n";
$xsl .= "<td>Current Song:</td>" . "\n";
$xsl .= "<td class=\"streamdata\">" . $currentsong . "</td>" . "\n";
$xsl .= "</tr>" . "\n";
$xsl .= "</table>" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "<div class=\"roundbottom\">" . "\n";
$xsl .= "<img src=\"images/corner_bottomleft.jpg\" class=\"corner\" style=\"display: none\" alt=\"\" />" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "<br /><br />" . "\n";
// Footer
$xsl .= "<div class=\"poster\">" . "\n";
$xsl .= "Support Icecast development at <a target=\"_blank\" href=\"http://www.icecast.org\">www.icecast.org</a>" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "</div>" . "\n";
$xsl .= "</body>" . "\n";
$xsl .= "</html>" . "\n";
fwrite($sock, $xsl);
fclose($sock);
unset($client_socks[array_search($sock, $client_socks)]);
break;
case '/style.css':
case '/favicon.ico':
case '/images/corner_bottomleft.jpg':
case '/images/corner_bottomright.jpg':
case '/images/corner_topleft.jpg':
case '/images/corner_topright.jpg':
case '/images/icecast.png':
case '/images/key.png':
case '/images/tunein.png':
// Get read file data
$fpath = AmpConfig::get('prefix') . '/channel' . $cmd['1'];
$pinfo = pathinfo($fpath);
$content_type = 'text/html';
switch ($pinfo['extension']) {
case 'css':
$content_type = "text/css";
break;
case 'jpg':
$content_type = "image/jpeg";
break;
case 'png':
$content_type = "image/png";
break;
case 'ico':
$content_type = "image/vnd.microsoft.icon";
break;
}
fwrite($sock, "HTTP/1.0 200 OK\r\n");
fwrite($sock, "Content-Type: " . $content_type . "\r\n");
$fdata = file_get_contents($fpath);
fwrite($sock, "Content-Length: " . strlen($fdata) . "\r\n");
fwrite($sock, "\r\n");
fwrite($sock, $fdata);
fclose($sock);
unset($client_socks[array_search($sock, $client_socks)]);
break;
case '/stream.' . $channel->stream_type . '.m3u':
fwrite($sock, "HTTP/1.0 200 OK\r\n");
fwrite($sock, "Cache-control: public\r\n");
fwrite($sock, "Content-Disposition: filename=stream." . $channel->stream_type . ".m3u\r\n");
fwrite($sock, "Content-Type: audio/x-mpegurl\r\n");
fwrite($sock, "\r\n");
fwrite($sock, $channel->get_stream_url() . "\n");
fclose($sock);
unset($client_socks[array_search($sock, $client_socks)]);
break;
default:
debug_event('channel', 'Unknown request. Closing connection.', '3');
fclose($sock);
unset($client_socks[array_search($sock, $client_socks)]);
break;
}
}
}
// Handle data parse
}
}
if ($channel->bitrate) {
$time_offset = microtime(true) - $last_stream;
//$mtime = ($last_stream > 0 && $time_offset < 1000000) ? $time_offset : 1;
$mtime = 1;
if ($last_stream > 0 && $time_offset < 1) {
usleep(1000000 - ($time_offset * 1000000));
} elseif ($last_stream > 0) {
//$mtime = $time_offset;
}
$nb_chunks = ceil(($mtime * $channel->bitrate * 1000) / 4096);
} else {
$nb_chunks = 1;
}
// Get multiple chunks according to bitrate to return enough data per second (because sleep with socket select)
for ($c = 0; $c < $nb_chunks; $c++) {
$chunk = $channel->get_chunk();
$chunklen = strlen($chunk);
if ($chunklen > 0) {
foreach($stream_clients as $key => $client)
{
$sock = $client['socket'];
if(!is_resource($sock)) {
client_disconnect($channel, $client_socks, $stream_clients, $sock);
continue;
}
$clchunk = $chunk;
// Check if we need to insert metadata information
if ($client['metadata']) {
$chkmdlen = ($client['length'] + $chunklen) - $client['metadata_lastsent'];
if ($chkmdlen >= $metadata_interval) {
$subpos = ($client['metadata_lastsent'] + $metadata_interval) - $client['length'];
fwrite($sock, substr($clchunk, 0, $subpos));
$client['length'] += $subpos;
if ($channel->media->id != $client['metadata_lastsong']) {
$metadata = "StreamTitle='" . str_replace('-', ' ', $channel->media->f_artist) . "-" . $channel->media->f_title . "';";
$metadata .= chr(0x00);
$metadatalen = ceil(strlen($metadata) / 16);
$metadata = str_pad($metadata, $metadatalen * 16, chr(0x00), STR_PAD_RIGHT);
//debug_event('channel', 'Sending metadata to client...', '5');
fwrite($sock, chr($metadatalen) . $metadata);
$client['metadata_lastsong'] = $channel->media->id;
} else {
fwrite($sock, chr(0x00));
}
$client['metadata_lastsent'] = $client['length'];
$clchunk = substr($chunk, $subpos);
}
}
if (strlen($clchunk) > 0) {
fwrite($sock, $clchunk);
$client['length'] += strlen($clchunk);
}
$stream_clients[$key] = $client;
//debug_event('channel', 'Client stream current length: ' . $client['length'], '5');
}
} else {
$channel->update_listeners(0);
die('No more data, stream ended.');
}
$last_stream = microtime(true);
}
}
ob_end_flush();
echo "\n";
function client_disconnect($channel, &$client_socks, &$stream_clients, $sock)
{
$key = array_search($sock, $client_socks);
unset($client_socks[$key]);
unset($stream_clients[$key]);
@fclose($sock);
$channel->update_listeners(count($client_socks));
debug_event('channel', 'A client disconnected. Now there are total '. count($client_socks) . ' clients.', '5');
echo "Client disconnected.\n";
ob_flush();
}
function usage()
{
echo T_("- Channel Listening -");
echo "\n";
echo T_("Usage: channel_run.inc [-c {CHANNEL ID}|-p {PORT}|-v]");
echo "\n\t";
echo "\n-c {CHANNEL ID}\t";
echo T_('Channel id to start');
echo "\n-p {PORT}\t";
echo T_('Listening port, default get an available port automatically');
echo "\n-v\t";
echo T_('Verbose');
echo "\n";
echo "----------------------------------------------------------";
echo "\n";
}
?>

View file

@ -0,0 +1,56 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/**
* Delete Disabled
* This WILL DELETE MUSIC!!!! it does what it's name would suggest and deletes
* any disabled songs
*/
/* will not delete anything if debug is true */
$debug = true;
define('NO_SESSION', '1');
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
if ($debug) { echo T_('DEBUG ENABLED WILL NOT DELETE FILES!'); echo "\n"; }
/* Get a list of filenames */
$sql = "SELECT `id`, `file` FROM song WHERE enabled='0'";
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
if ($debug) {
printf (T_('Would Delete: %s'), $row['file']);
echo "\n";
}
else {
printf (T_('Deleting: %s'), $row['file']);
echo "\n";
unlink($row['file']);
$sql = 'DELETE FROM `song` WHERE `id` = ?';
$del_results = Dba::write($sql, array($row['id']));
}
}
?>

View file

@ -0,0 +1,46 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
// Turn off output buffering we don't need it for a command line script
ob_end_clean();
$meta = 'linux';
// Take input from the command line, two options linux or windows
if (count($_SERVER['argv']) > 1) {
$meta = ($_SERVER['argv']['1'] == 'windows') ? 'windows' : 'linux';
}
$catalogs = Catalog::get_catalogs();
foreach ($catalogs as $catalog_id) {
$catalog = Catalog::create_from_id($catalog_id);
$catalog->dump_album_art(array('metadata' => $meta));
}
?>

View file

@ -0,0 +1,239 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
ob_end_clean();
/*
* Pull the root path of your catalogs one by one
* and then do a directory sweep and check all of the files
* that would be cataloged and see if they have the correct charset
* if they don't prompt for a rename, unless $i_am_crazy is true then just
* do it
*/
// If set to true / 1 then it will not prompt!
//$GLOBALS['i_am_crazy'] = true;
if (!function_exists('iconv')) {
echo T_("ERROR: Iconv required for this functionality, quiting");
echo "\n";
exit;
}
// Attempt to figure out what the System Charset is
$source_encoding = iconv_get_encoding('output_encoding');
// Attempt a simple translation
$string = sprintf(T_('%s For the Love of Music'), iconv(AmpConfig::get('site_charset'),AmpConfig::get('site_charset')));
echo T_('Testing Basic Translation, the two strings below should look the same');
echo "\n";
echo T_('Original: For the Love of Music');
echo "\n";
printf (T_('Translated: %s'), $string);
echo "\n";
echo "---------------------------------------------------------------------\n";
printf (T_('Input Charset (%s):'), $source_encoding);
$input = trim(fgets(STDIN));
if (strlen($input) > 0) { $source_encoding = trim($input); }
printf (T_('Using %s as source character set'), $source_encoding);
echo "\n";
$sql = "SELECT id FROM `catalog` WHERE `catalog_type`='local'";
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
$catalog = Catalog::create_from_id($row['0']);
printf(T_('Checking %s (%s)'), $catalog->name, $catalog->path);
echo "\n";
charset_directory_correct($catalog->path);
} // end of the catalogs
echo T_('Finished checking filenames for valid chacters');
echo "\n";
/**************************************************
****************** FUNCTIONS *********************
**************************************************/
/**
* charset_directory_correct
* This function calls its self recursivly
* and corrects all of the non-matching filenames
* it looks at the i_am_crazy var and if not set prompts for change
*/
function charset_directory_correct($path) {
// Correctly detect the slash we need to use here
if (strstr($path,"/")) {
$slash_type = '/';
}
else {
$slash_type = '\\';
}
/* Open up the directory */
$handle = opendir($path);
if (!is_resource($handle)) {
printf (T_('ERROR: Unable to open %s'), $path);
echo "\n";
return false;
}
if (!chdir($path)) {
printf (T_('ERROR: Unable to chdir to %s'), $path);
echo "\n";
return false;
}
while ( false !== ($file = readdir($handle) ) ) {
if ($file == '.' || $file == '..') { continue; }
$full_file = $path.$slash_type.$file;
if (is_dir($full_file)) {
charset_directory_correct($full_file);
continue;
}
$verify_filename = iconv(AmpConfig::get('site_charset'),AmpConfig::get('site_charset') . '//IGNORE',$full_file);
if (strcmp($full_file,$verify_filename) != '0') {
$translated_filename = iconv($source_encoding,AmpConfig::get('site_charset') . '//TRANSLIT',$full_file);
// Make sure the extension stayed the same
if (substr($translated_filename,strlen($translated_filename)-3,3) != substr($full_file,strlen($full_file)-3,3)) {
echo T_("Translation failure, stripping non-valid characters");
echo "\n";
$translated_filename = iconv($source_encoding,AmpConfig::get('site_charset') . '//IGNORE',$full_file);
}
printf (T_('Attempting to Transcode to %s'), AmpConfig::get('site_charset'));
echo "\n";
echo "--------------------------------------------------------------------------------------------\n";
printf (T_('OLD: %s has invalid chars'), $full_file);
echo "\n";
printf (T_('NEW: %s'), $translated_filename);
echo "\n";
echo "--------------------------------------------------------------------------------------------\n";
if (!$GLOBALS['i_am_crazy']) {
echo T_("Rename File (Y/N):");
$input = trim(fgets(STDIN));
if (strcasecmp($input,'Y') == 0) { charset_rename_file($full_file,$translated_filename); }
else { echo "\n\t"; echo T_('Not Renaming...'); echo "\n\n"; }
}
else {
charset_rename_file($full_file,$translated_filename);
}
}
} // while reading file
} // charset_directory_correct
/**
* charset_rename_file
* This just takes a source / dest and does the renaming
*/
function charset_rename_file($full_file,$translated_filename) {
// First break out the base directory name and make sure it exists
// in case our crap char is in the directory
$directory = dirname($translated_filename);
$data = preg_split("/[\/\\\]/",$directory);
$path = '';
foreach ($data as $dir) {
$dir = charset_clean_name($dir);
$path .= "/" . $dir;
if (!is_dir($path)) {
echo "\tMaking $path directory\n";
$results = mkdir($path);
if (!$results) {
printf (T_('Error: Unable to create %s move failed, stopping'), $path);
echo "\n";
return false;
}
} // if the dir doesn't exist
} // end foreach
// Now to copy the file
$results = copy($full_file,$translated_filename);
if (!$results) {
echo T_('Error: Copy Failed, not deleteing old file');
echo "\n";
return false;
}
$old_sum = filesize($full_file);
$new_sum = filesize($translated_filename);
if ($old_sum != $new_sum OR !$new_sum) {
printf (T_('Error: Size Inconsistency, not deleting %s'), $full_file);
echo "\n";
return false;
}
$results = unlink($full_file);
if (!$results) { printf (T_('Error: Unable to delete %s'), $full_file); echo "\n"; return false; }
echo T_("File Moved...");
echo "\n\n";
return true;
} // charset_rename_file
/**
* charset_clean_name
* We have to have some special rules here
* This is run on every individual element of the search
* Before it is put togeather, this removes / and \ and also
* once I figure it out, it'll clean other stuff
*/
function charset_clean_name($string) {
/* First remove any / or \ chars */
$string = preg_replace('/[\/\\\]/','-',$string);
$string = str_replace(':',' ',$string);
$string = preg_replace('/[\!\:\*]/','_',$string);
return $string;
} // charset_clean_name
?>

View file

@ -0,0 +1 @@
Deny from all

View file

@ -0,0 +1,60 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
if(php_sapi_name() != 'cli') {
exit(1);
}
define('NO_SESSION', 1);
define('CLI', 1);
$path = dirname(__FILE__);
$prefix = realpath($path . '/../../');
require_once $prefix . '/lib/init.php';
$options = getopt('e:l:n:p:u:w:');
if (!$options || !isset($options['u'])) {
echo "Usage: add_user.inc -u <username> [ -l <access level> ] [ -p <password ] [ -e <email> ] [ -w <website> ] [ -n <name> ]\n";
exit(1);
}
$username = $options['u'];
$password = isset($options['p']) ? $options['p'] : mt_rand();
$access = isset($options['l']) ? $options['l'] : AmpConfig::get('auto_user');
$access = isset($access) ? $access : 'guest';
$access = is_numeric($access) ? $access : User::access_name_to_level($access);
$email = isset($options['e']) ? $options['e'] : '';
$website = isset($options['w']) ? $options['w'] : '';
$name = isset($options['n']) ? $options['n'] : '';
if (User::create($username, $name, $email, $website, $password, $access)) {
printf(T_('Created %s user %s with password %s'), T_($access), $username, $password);
echo "\n";
}
else {
echo T_('User creation failed'), "\n";
exit(1);
}
User::fix_preferences('-1');
?>

View file

@ -0,0 +1,134 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
if(php_sapi_name() != 'cli') {
exit(1);
}
define('NO_SESSION', 1);
define('CLI', 1);
$path = dirname(__FILE__);
$prefix = realpath($path . '/../../');
require_once $prefix . '/lib/init-tiny.php';
require_once $prefix . '/lib/install.lib.php';
$options = getopt(
'h:d:fp:P:u:U:w:',
array(
'database-user:',
'database-password:',
'database-host:',
'database-port:',
'database-name:',
'ampache-database-user:',
'ampache-database-password:',
'webpath:',
'force'
)
);
$force = isset($options['f']) || isset($options['force']);
$db_user = $options['U'] ?: $options['database-user'];
$db_pass = $options['P'] ?: $options['database-password'];
$db_host = $options['h'] ?: $options['database-host'];
$db_port = $options['database-port'];
$db_name = $options['d'] ?: $options['database-name'];
$new_db_user = $options['u'] ?: $options['ampache-database-user'];
$new_db_pass = $options['p'] ?: $options['ampache-database-password'];
$web_path = $options['w'] ?: $options ['webpath'];
// Make sure we have all the required information
if (!$db_user || !$db_pass || !$db_host || !$db_name) {
usage();
}
// Now let's make sure it's not already installed
if (!install_check_status($configfile)) {
echo "\n", T_('Existing Ampache installation found.'), "\n";
if ($force) {
echo T_('Force specified, proceeding anyway.'), "\n";
}
else {
echo T_('Exiting.'), "\n";
exit(1);
}
}
AmpConfig::set_by_array(array(
'web_path' => $web_path,
'database_name' => $db_name,
'database_username' => $db_user,
'database_password' => $db_pass,
'database_hostname' => $db_host,
'database_port' => $db_port
), true);
// 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";
exit(1);
}
AmpConfig::set_by_array(array(
'database_username' => $new_db_user ?: $db_user,
'database_password' => $new_db_pass ?: $db_pass
), true);
// Write the config file
if (!install_create_config()) {
echo T_('Config file creation failed'), "\n";
echo Error::get('general') . "\n\n";
exit(1);
}
/**
* usage
* This just prints out the required params for this script
**/
function usage() {
echo "Usage: install_db.inc [options]";
echo "\n\t-U, --database-user\t\t\t";
echo 'MySQL Admin User';
echo "\n\t-P, --database-password\t\t\t";
echo 'MySQL Admin Password';
echo "\n\t-h, --database-host\t\t\t";
echo 'MySQL Hostname';
echo "\n\t--database-port\t\t\t";
echo 'MySQL Database Port';
echo "\n\t-d, --database-name\t\t\t";
echo "MySQL Database Name";
echo "\n\t-u, --ampache-database-user\t";
echo 'MySQL Application Username';
echo "\n\t-p, --ampache-database-password\t";
echo 'MySQL Application Password';
echo "\n\t-w, --webpath\t\t\t\t";
echo 'Web path';
echo "\n\t-f, --force\t\t\t\t";
echo 'Force installation', "\n";
exit(1);
}
?>

View file

@ -0,0 +1,49 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
if(php_sapi_name() != 'cli') {
exit(1);
}
define('NO_SESSION', 1);
define('OUTDATED_DATABASE_OK', 1);
define('CLI', 1);
$path = dirname(__FILE__);
$prefix = realpath($path . '/../../');
require_once $prefix . '/lib/init.php';
$options = getopt('u', array('update'));
$run_update = (isset($options['u']) || isset($options['update']));
if (Update::need_update() && $run_update) {
Update::run_update();
}
if (Update::need_update()) {
echo T_('The following updates need to be performed:'), "\n";
}
Update::display_update();
?>

View file

@ -0,0 +1,96 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
$unmigratable = array('auth_methods'=>'mysql',
'tag_order'=>'id3v2,id3v1,vorbiscomment,quicktime,ape,asf',
'album_art_order'=>'db,id3,folder,lastfm,amazon',
'amazon_base_urls'=>'http://webservices.amazon.com');
$translate = array('local_host'=>'database_hostname',
'local_db'=>'database_name',
'local_username'=>'database_username',
'local_pass'=>'database_password',
'local_length'=>'session_length',
'stream_cmd_flac'=>'transcode_cmd_flac',
'stream_cmd_mp3'=>'transcode_cmd_mp3',
'stream_cmd_m4a'=>'transcode_cmd_m4a',
'stream_cmd_ogg'=>'transcode_cmd_ogg',
'stream_cmd_mpc'=>'transcode_cmd_mpc',
'sess_name'=>'session_name',
'sess_cookielife'=>'session_cookielife',
'sess_cookiesecure'=>'session_cookiesecure');
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
$old_config = file_get_contents($prefix . '/config/ampache.cfg.php');
$data = explode("\n",$old_config);
echo T_("Parsing old config file...");
echo "\n";
foreach ($data as $line) {
// Replace a # with ;
if ($line['0'] == '#') {
$line = substr_replace($line,";",0,1);
}
foreach ($unmigratable as $option=>$default) {
if (strstr($line,$option) AND !$migrated[$option]) {
$line = $option . " = \"$default\"";
$migrated[$option] = true;
}
elseif (strstr($line,$option)) {
$line = ';' . $line;
}
}
foreach ($translate as $old=>$new) {
if (strstr($line,$old)) {
$line = str_replace($old,$new,$line);
}
}
$new_config .= $line . "\n";
} // end foreach lines
echo T_("Parse complete, writing");
echo "\n";
$handle = fopen($prefix . '/config/ampache.cfg.php','w');
$worked = fwrite($handle,$new_config);
if ($worked) {
echo T_("Write success, config migrated");
echo "\n";
}
else {
echo T_("Access Denied, config migration failed");
echo "\n";
}
?>

View file

@ -0,0 +1,89 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
$version = "1.0";
if (count($GLOBALS['argv']) != 2) {
usage();
exit;
} else {
$filename = $GLOBALS['argv'][1];
}
if(!file_exists($filename)) {
print T_("File not found.");
print "\n";
usage();
exit;
}
printf(T_('Reading: %s'), $filename);
print "\n";
/* Attempt to figure out what catalog it comes from */
$sql = "SELECT `catalog`.`id` FROM `song` INNER JOIN `catalog` ON `song`.`catalog`=`catalog`.`id` WHERE `song`.`file` LIKE '%" . Dba::escape($filename) . "'";
$db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);
$catalog = Catalog::create_from_id($results['id']);
$dir_pattern = $catalog->sort_pattern;
$file_pattern = $catalog->rename_pattern;
$info = new vainfo($filename, '', '', '', $dir_pattern, $file_pattern);
if(isset($dir_pattern) || isset($file_pattern)) {
printf(T_('Using: %s AND %s for file pattern matching'), $dir_pattern, $file_pattern);
print "\n";
}
$info->get_info();
$results = $info->tags;
$keys = vainfo::get_tag_type($results);
$ampache_results = vainfo::clean_tag_info($results, $keys, $filename);
echo "\n";
echo T_('Raw results:');
echo "\n\n";
print_r($info);
echo "\n------------------------------------------------------------------\n";
printf(T_('Final results seen by Ampache using %s:'), implode(' + ', $keys));
echo "\n\n";
print_r($ampache_results);
function usage() {
global $version;
$text = sprintf(T_('%s Version %s'), 'print_tags.inc', $version);
$text .= "\n\n";
$text .= T_('Usage:');
$text .= "\n";
$text .= T_('php print_tags.inc <Filename>');
$text .= "\n\n";
return print $text;
}// usage()
?>

308
sources/bin/sort_files.inc Normal file
View file

@ -0,0 +1,308 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/**
* Still not fully tested but "Appears to work" use at your own risk
* sort_files
* This script has a lot of stuff to worry about. It's primary duty is to re-organize
* your files based on some sane, and predefined (in the interface) order using the
* tag information gathered and updated in ampache. Sort_Pattern defines the directory
* structure and rename_pattern defines the file pattern. This script should allow you
* to do both or neither. Oooh and allow you to sort with A,B,C,D prefix
*
* Attempt 1 - Do each file one by one and satisfy the needs of each file by its self (this is going to be slow)
* Cache information so we don't have to check for every file!
*/
/* Don't do anything just tell me what you would do */
//$test_mode = true;
/* m(__)m */
$alphabet_prefix = true;
define('NO_SESSION','1');
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
ob_end_clean();
/* First Clean the catalog to we don't try to write anything we shouldn't */
$sql = "SELECT `id` FROM `catalog` WHERE `catalog_type`='local'";
$db_results = Dba::read($sql);
$catalogs = array();
while ($r = Dba::fetch_row($db_results)) {
$catalog = Catalog::create_from_id($r['0']);
$songs = $catalog->get_songs();
printf (T_('Starting Catalog: %s'), stripslashes($catalog->name));
echo "\n";
/* Foreach through each file and find it a home! */
foreach ($songs as $song) {
/* Find this poor song a home */
$song->format();
$song->format_pattern();
$directory = sort_find_home($song,$catalog->sort_pattern,$catalog->path);
$filename = $song->f_file;
$fullpath = $directory . "/" . $filename;
/* Check for Demo Mode */
if ($test_mode) {
/* We're just talking here... no work */
echo T_("Moving File...");
echo "\n\t";
printf (T_('Source: %s'), $song->file);
echo "\n\t";
printf (T_('Dest: %s'), $fullpath);
echo "\n";
flush();
}
/* We need to actually do the moving (fake it if we are testing)
* Don't try to move it, if it's already the same friggin thing!
*/
if ($song->file != $fullpath && strlen($fullpath)) {
sort_move_file($song,$fullpath);
}
} // end foreach song
} // end foreach catalogs
/************** FUNCTIONS *****************/
/**
* sort_find_home
* Get the directory for this file from the catalog and the song info using the sort_pattern
* takes into account various artists and the alphabet_prefix
*/
function sort_find_home($song,$sort_pattern,$base) {
$home = rtrim($base,"\/");
$home = rtrim($home,"\\");
/* Create the filename that this file should have */
$album = sort_clean_name($song->f_album_full);
$artist = sort_clean_name($song->f_artist_full);
$track = sort_clean_name($song->track);
$title = sort_clean_name($song->title);
$year = sort_clean_name($song->year);
$comment = sort_clean_name($song->comment);
/* Do the various check */
$album_object = new Album($song->album);
$album_object->format();
if ($album_object->artist_count != '1') {
$artist = "Various";
}
/* IF we want a,b,c,d we need to know the first element */
if ($GLOBALS['alphabet_prefix']) {
$sort_pattern = preg_replace("/\/?%o\//","",$sort_pattern);
$first_element = substr($sort_pattern,0,2);
$element = sort_element_name($first_element);
if (!$element) { $alphabet = 'ZZ'; }
else { $alphabet = strtoupper(substr(${$element},0,1)); }
$alphabet = preg_replace("/[^A-Za-z0-9]/","ZZ",$alphabet);
$home .= "/$alphabet";
}
/* Replace everything we can find */
$replace_array = array('%a','%A','%t','%T','%y','%c');
$content_array = array($artist,$album,$title,$track,$year,$comment);
$sort_pattern = str_replace($replace_array,$content_array,$sort_pattern);
/* Remove non A-Z0-9 chars */
$sort_pattern = preg_replace("[^\\\/A-Za-z0-9\-\_\ \'\,\(\)]","_",$sort_pattern);
$home .= "/$sort_pattern";
return $home;
} // sort_find_home
/**
* sort_element_name
* gets the name of the %? in a yea.. too much beer
*/
function sort_element_name($key) {
switch ($key) {
case '%t':
return 'title';
break;
case '%T':
return 'track';
break;
case '%a':
return 'artist';
break;
case '%A':
return 'album';
break;
case '%y':
return 'year';
break;
default:
break;
} // switch on key
return false;
} // sort_element_name
/**
* sort_clean_name
* We have to have some special rules here
* This is run on every individual element of the search
* Before it is put togeather, this removes / and \ and also
* once I figure it out, it'll clean other stuff
*/
function sort_clean_name($string) {
/* First remove any / or \ chars */
$string = preg_replace('/[\/\\\]/','-',$string);
$string = str_replace(':',' ',$string);
$string = preg_replace('/[\!\:\*]/','_',$string);
return $string;
} // sort_clean_name
/**
* sort_move_file
* All this function does is, move the friggin file and then update the database
* We can't use the rename() function of PHP because it's functionality depends on the
* current phase of the moon, the alignment of the planets and my current BAL
* Instead we cheeseball it and walk through the new dir structure and make
* sure that the directories exist, once the dirs exist then we do a copy
* and unlink.. This is a little unsafe, and as such it verifys the copy
* worked by doing a filesize() before unlinking.
*/
function sort_move_file($song,$fullname) {
$old_dir = dirname($song->file);
$info = pathinfo($fullname);
$directory = $info['dirname'];
$file = $info['basename'];
$data = preg_split("/[\/\\\]/",$directory);
$path = '';
/* We not need the leading / */
unset($data[0]);
foreach ($data as $dir) {
$dir = sort_clean_name($dir);
$path .= "/" . $dir;
/* We need to check for the existance of this directory */
if (!is_dir($path)) {
if ($GLOBALS['test_mode']) {
echo "\t";
printf (T_('Making %s Directory'), $path);
echo "\n";
}
else {
debug_event('mkdir',"Creating $path directory",'5');
$results = mkdir($path);
if (!$results) {
printf (T_('Error: Unable to create %s move failed'), $path);
echo "\n";
return false;
}
} // else we aren't in test mode
} // if it's not a dir
} // foreach dir
/* Now that we've got the correct directory structure let's try to copy it */
if ($GLOBALS['test_mode']) {
echo "\t";
// HINT: %1$s: file, %2$s: directory
printf (T_('Copying %1$s to %2$s'), $file, $directory);
echo "\n";
$sql = "UPDATE song SET file='" . Dba::escape($fullname) . "' WHERE id='" . Dba::escape($song->id) . "'";
echo "\tSQL: $sql\n";
flush();
}
else {
/* Check for file existance */
if (file_exists($fullname)) {
debug_event('file exists','Error: $fullname already exists','1');
printf (T_('Error: %s already exists'), $filename);
echo "\n";
return false;
}
$results = copy($song->file,$fullname);
debug_event('copy','Copied ' . $song->file . ' to ' . $fullname,'5');
/* Look for the folder art and copy that as well */
if (!AmpConfig::get('album_art_preferred_filename') OR strstr(AmpConfig::get('album_art_preferred_filename'),"%")) {
$folder_art = $directory . '/folder.jpg';
$old_art = $old_dir . '/folder.jpg';
}
else {
$folder_art = $directory . "/" . sort_clean_name(AmpConfig::get('album_art_preferred_filename'));
$old_art = $old_dir . "/" . sort_clean_name(AmpConfig::get('album_art_preferred_filename'));
}
debug_event('copy_art','Copied ' . $old_art . ' to ' . $folder_art,'5');
@copy($old_art,$folder_art);
if (!$results) { printf (T_('Error: Unable to copy file to %s'), $fullname); echo "\n"; return false; }
/* Check the filesize */
$new_sum = filesize($fullname);
$old_sum = filesize($song->file);
if ($new_sum != $old_sum OR !$new_sum) {
printf (T_('Error: Size Inconsistency, not deleting %s'), $song->file);
echo "\n";
return false;
} // end if sum's don't match
/* If we've made it this far it should be safe */
$results = unlink($song->file);
if (!$results) { printf (T_('Error: Unable to delete %s'), $song->file); echo "\n"; }
/* Update the catalog */
$sql = "UPDATE song SET file='" . Dba::escape($fullname) . "' WHERE id='" . Dba::escape($song->id) . "'";
$db_results = Dba::write($sql);
} // end else
return true;
} // sort_move_file
?>

View file

@ -0,0 +1,80 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
define('NO_SESSION','1');
define('CLI', 1);
$path = dirname(__FILE__);
$prefix = realpath($path . '/../');
require_once $prefix . '/lib/init.php';
ob_end_flush();
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;
$verbose = false;
$port = 8100;
$cargv = count($_SERVER['argv']);
if ($cargv > 1) {
for ($x = 1; $x < $cargv; $x++) {
if ($_SERVER['argv'][$x] == "-v") {
$operations_string .= "\n\t" . T_('- Verbose');
$verbose = true;
}
elseif ($_SERVER['argv'][$x] == "-p" && ($x + 1) < $cargv) {
$port = intval($_SERVER['argv'][++$x]);
$operations_string .= "\n\t" . T_('- Port ' . $port);
}
}
}
$urlinfo = parse_url(AmpConfig::get('websocket_address'));
$host = $urlinfo['host'];
if (empty($host)) {
$host = "localhost";
}
$app = new Ratchet\App($host, $port, '0.0.0.0');
$brserver = new Broadcast_Server();
$brserver->verbose = $verbose;
$app->route('/broadcast', $brserver);
$app->route('/echo', new Ratchet\Server\EchoServer, array('*'));
$app->run();
function usage()
{
echo T_("- WebSocket server -");
echo "\n";
echo T_("Usage: websocket_run.inc [-p {PORT}|-v]");
echo "\n\t";
echo "\n-p {PORT}\t";
echo T_('Listening port, default 8100');
echo "\n-v\t";
echo T_('Verbose');
echo "\n";
echo "----------------------------------------------------------";
echo "\n";
}
?>

View file

@ -0,0 +1,76 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/*
* Use with caution, this hasn't been heavily tested!!!
*/
define('NO_SESSION','1');
require_once '../lib/init.php';
if (!$GLOBALS['argv']['1'] || $GLOBALS['argv']['1'] == '-h') { usage(); }
else {
$dirname = $GLOBALS['argv']['1'];
$type = $GLOBALS['argv']['2'];
}
// Make sure the output dir is valid and writeable
if (!is_writeable($dirname)) {
printf (T_('Error: Directory %s not writeable'), $dirname);
echo "\n";
}
// Switch on the type of playlist dump we want to do
// here
switch ($type) {
case 'playlists':
break;
case 'artist':
break;
default:
break;
} // end type switch
/* FUNCTIONS */
function usage() {
$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>
$desc1
$desc2
default $desc3
playlists $desc4
artist $desc5\n\n";
exit($string);
} // useage
?>

54
sources/broadcast.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
UI::show_header();
/* Switch on the action passed in */
switch ($_REQUEST['action']) {
case 'show_delete':
UI::show_header();
$id = $_REQUEST['id'];
$next_url = AmpConfig::get('web_path') . '/broadcast.php?action=delete&id=' . scrub_out($id);
show_confirmation(T_('Broadcast Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_broadcast');
UI::show_footer();
exit;
case 'delete':
if (AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
UI::show_header();
$id = $_REQUEST['id'];
$broadcast = new Broadcast($id);
if ($broadcast->delete()) {
$next_url = AmpConfig::get('web_path') . '/browse.php?action=broadcast';
show_confirmation(T_('Broadcast Deleted'), T_('The Broadcast has been deleted'), $next_url);
}
UI::show_footer();
exit;
} // switch on the action
UI::show_footer();

147
sources/browse.php Normal file
View file

@ -0,0 +1,147 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/**
* Browse Page
* This page shows the browse menu, which allows you to browse by many different
* fields including artist, album, and catalog.
*
* This page also handles the actual browse action
*/
/* Base Require */
require_once 'lib/init.php';
session_start();
// This page is a little wonky we don't want the sidebar until we know what
// type we're dealing with so we've got a little switch here that creates the
// type.. this feels hackish...
$browse = new Browse();
switch ($_REQUEST['action']) {
case 'tag':
case 'file':
case 'album':
case 'artist':
case 'playlist':
case 'smartplaylist':
case 'live_stream':
case 'video':
case 'song':
case 'channel':
case 'broadcast':
$browse->set_type($_REQUEST['action']);
$browse->set_simple_browse(true);
break;
} // end switch
UI::show_header();
switch ($_REQUEST['action']) {
case 'file':
break;
case 'album':
$browse->set_filter('catalog',$_SESSION['catalog']);
if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1');
}
$browse->set_sort('name','ASC');
$browse->show_objects();
break;
case 'tag':
//FIXME: This whole thing is ugly, even though it works.
$browse->set_sort('count','ASC');
// This one's a doozy
$browse->set_simple_browse(false);
$browse->save_objects(Tag::get_tags(/*AmpConfig::get('offset_limit')*/)); // Should add a pager?
$object_ids = $browse->get_saved();
$keys = array_keys($object_ids);
Tag::build_cache($keys);
UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud');
$browse2 = new Browse();
$browse2->set_type('song');
$browse2->store();
require_once AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php';
UI::show_box_bottom();
$type = $browse2->get_type();
require_once AmpConfig::get('prefix') . '/templates/browse_content.inc.php';
break;
case 'artist':
$browse->set_filter('catalog',$_SESSION['catalog']);
if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1');
}
$browse->set_sort('name','ASC');
$browse->show_objects();
break;
case 'song':
$browse->set_filter('catalog',$_SESSION['catalog']);
if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1');
}
$browse->set_sort('title','ASC');
$browse->show_objects();
break;
case 'live_stream':
if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1');
}
$browse->set_sort('name','ASC');
$browse->show_objects();
break;
case 'catalog':
break;
case 'playlist':
$browse->set_sort('type','ASC');
$browse->set_filter('playlist_type','1');
$browse->show_objects();
break;
case 'smartplaylist':
$browse->set_sort('type', 'ASC');
$browse->set_filter('playlist_type','1');
$browse->show_objects();
break;
case 'channel':
$browse->set_sort('id', 'ASC');
$browse->show_objects();
break;
case 'broadcast':
$browse->set_sort('id', 'ASC');
$browse->show_objects();
break;
case 'video':
if (AmpConfig::get('catalog_disable')) {
$browse->set_filter('catalog_enabled', '1');
}
$browse->set_sort('title','ASC');
$browse->show_objects();
break;
default:
break;
} // end Switch $action
$browse->store();
/* Show the Footer */
UI::show_footer();

89
sources/channel.php Normal file
View file

@ -0,0 +1,89 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
UI::show_header();
/* Switch on the action passed in */
switch ($_REQUEST['action']) {
case 'show_create':
UI::show_header();
$type = Channel::format_type($_REQUEST['type']);
if (!empty($type) && !empty($_REQUEST['id'])) {
$object = new $type($_REQUEST['id']);
if ($object->id) {
$object->format();
require_once AmpConfig::get('prefix') . '/templates/show_add_channel.inc.php';
}
}
UI::show_footer();
exit;
case 'create':
if (AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
if (!Core::form_verify('add_channel','post')) {
UI::access_denied();
exit;
}
UI::show_header();
$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';
} else {
$title = T_('Channel Created');
show_confirmation($title, $body, AmpConfig::get('web_path') . '/browse.php?action=channel');
}
UI::show_footer();
exit;
case 'show_delete':
UI::show_header();
$id = $_REQUEST['id'];
$next_url = AmpConfig::get('web_path') . '/channel.php?action=delete&id=' . scrub_out($id);
show_confirmation(T_('Channel Delete'), T_('Confirm Deletion Request'), $next_url, 1, 'delete_channel');
UI::show_footer();
exit;
case 'delete':
if (AmpConfig::get('demo_mode')) {
UI::access_denied();
exit;
}
UI::show_header();
$id = $_REQUEST['id'];
$channel = new Channel($id);
if ($channel->delete()) {
$next_url = AmpConfig::get('web_path') . '/browse.php?action=channel';
show_confirmation(T_('Channel Deleted'), T_('The Channel has been deleted'), $next_url);
}
UI::show_footer();
exit;
} // switch on the action
UI::show_footer();

View file

@ -0,0 +1,6 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteRule ^([0-9]+)/(.*)$ index.php?channel=$1&target=$2 [PT,L,QSA]
</IfModule>

BIN
sources/channel/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

122
sources/channel/index.php Normal file
View file

@ -0,0 +1,122 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/*
This is the wrapper for opening music streams from this server. This script
will play the local version or redirect to the remote server if that be
the case. Also this will update local statistics for songs as well.
This is also where it decides if you need to be downsampled.
*/
define('NO_SESSION','1');
require_once '../lib/init.php';
ob_end_clean();
set_time_limit(0);
$channel = new Channel($_REQUEST['channel']);
if (!$channel->id) {
debug_event('channel', 'Unknown channel.', '1');
exit;
}
if (!function_exists('curl_version')) {
debug_event('channel', 'Error: Curl is required for this feature.', '1');
exit;
}
// Authenticate the user here
if ($channel->is_private) {
$is_auth = false;
if (isset($_SERVER['PHP_AUTH_USER'])) {
$htusername = $_SERVER['PHP_AUTH_USER'];
$htpassword = $_SERVER['PHP_AUTH_PW'];
$auth = Auth::login($htusername, $htpassword);
if ($auth['success']) {
$username = $auth['username'];
$GLOBALS['user'] = new User($username);
$is_auth = true;
Preference::init();
if (AmpConfig::get('access_control')) {
if (!Access::check_network('stream',$GLOBALS['user']->id,'25') AND
!Access::check_network('network',$GLOBALS['user']->id,'25')) {
debug_event('UI::access_denied', "Streaming Access Denied: " . $_SERVER['REMOTE_ADDR'] . " does not have stream level access",'3');
UI::access_denied();
exit;
}
}
}
}
if (!$is_auth) {
header('WWW-Authenticate: Basic realm="Ampache Channel Authentication"');
header('HTTP/1.0 401 Unauthorized');
echo T_('Unauthorized.');
exit;
}
}
$url = 'http://' . $channel->interface . ':' . $channel->port . '/' . $_REQUEST['target'];
// Redirect request to the real channel server
$headers = getallheaders();
$headers['Host'] = $channel->interface;
$reqheaders = array();
foreach ($headers as $key => $value) {
$reqheaders[] = $key . ': ' . $value;
}
$ch = curl_init($url);
curl_setopt_array($ch, array(
CURLOPT_HTTPHEADER => $reqheaders,
CURLOPT_HEADER => false,
CURLOPT_RETURNTRANSFER => false,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HEADERFUNCTION => 'output_header',
CURLOPT_NOPROGRESS => false,
CURLOPT_PROGRESSFUNCTION => 'progress',
));
curl_exec($ch);
curl_close($ch);
/**
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function progress($totaldownload, $downloaded, $us, $ud)
{
ob_flush();
}
/**
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function output_header($ch, $header)
{
$th = trim($header);
if (!empty($th)) {
header($th);
}
return strlen($header);
}

305
sources/channel/style.css Normal file
View file

@ -0,0 +1,305 @@
/******************************************************************************
This file styles the bar that goes across the top of all Xiph.Org
pages.
The style that comes from this was first (to my knowledge) at
http://alistapart.com/stories/practicalcss/ in the
"Splitting the Difference" section.
******************************************************************************/
/* This effect doesn't work at all if all content is pinched in a bit. */
html, body {
margin: 0;
padding: 0;
color: white !important;
background: black;
}
.xiphnav {
font-family: Verdana, sans-serif;
font-weight: normal;
padding: .25em;
margin-bottom: .5em;
border-bottom: 1px solid #000;
color: #000;
background: #aaa;
}
.nav h1 {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: bold;
font-size: 300%;
color: #fff;
margin-top: 0px;
margin-bottom: 10px;
padding-top: 10px;
padding-bottom: 0px;
padding-left: 90px;
height: 70px;
background: url(images/icecast.png) no-repeat left center;
}
.nav {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: bold;
font-size: 90%;
}
.nav a {
color: white;
text-decoration: none;
}
.nav a:hover {
color: #f8ef64;
}
.xiphnav_a {
text-decoration: none;
font-weight: normal;
color: #000;
}
.main {
font-family: Verdana, sans-serif;
background-color: #000;
margin-left: 50px;
width: 90%;
}
.main h1 {
text-decoration: none;
font-weight: bold;
font-size: 300%;
color: #fff;
padding-top: 30px;
padding-bottom: 30px;
padding-left: 90px;
margin-top: 0px;
margin-bottom: 10px;
background: url(images/icecast.png) no-repeat left center;
}
.main iframe {
width: 100%;
border: 0;
}
.news {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
color: #fff;
}
.newsheader {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
font-size: 110%;
color: #f8ef64;
background: #444;
}
.streamtd {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
font-size: 85%;
color: #fff;
padding:15px;
}
.streamtd_alt {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
font-size: 85%;
color: #fff;
}
.streamtd_alt_2 {
font-family: Verdana, sans-serif;
text-decoration: underline;
font-weight: normal;
font-size: 85%;
color: #fff;
}
td {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
color: #fff;
}
.roundcont {
background-color: #656565;
color: #fff;
padding: 0px;
margin: 0px;
border-collapse: collapse;
}
.roundcont table{
border: none;
border-collapse: collapse;
}
.newscontent {
margin: 0 20px;
}
h3 {
margin: 0px;
padding: 0px;
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: bold;
font-size: 110%;
color: #f8ef64;
}
.newscontent h3 {
margin-bottom: 10px;
border-bottom: 1px groove #ACACAC;
}
.newscontent h4 {
margin: 10px 0px;
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: bold;
font-size: 110%;
color: #f8ef64;
}
.newscontent p {
margin: 0 0;
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
font-size: 90%;
}
.newscontent td {
margin: 0 0;
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
font-size: 90%;
}
.newscontent td.streamdata {
margin: 0 0;
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: normal;
font-size: 90%;
color: #f8ef64;
}
.streamheader table {
width: 100%;
margin-bottom: 10px;
border-bottom: 1px groove #ACACAC;
}
.streamheader td {
margin: 0px;
padding: 6px 0px;
border: 0px solid cyan;
}
.streamheader h3 {
margin: 0px;
border: 0px solid blue;
vertical-align: lower;
}
.streamheader a {
padding: 8px 5px 3px 30px;
text-decoration: none;
margin: 0px 0px 0px 20px;
background: transparent url("images/tunein.png") no-repeat left center;
}
.streamheader a.auth {
margin: 0px;
padding-top: 14px;
padding-bottom: 14px;
background: transparent url("images/key.png") no-repeat left center;
}
.newscontent a {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: bold;
color: #f8ef64;
}
.newscontent a:hover {
font-family: Verdana, sans-serif;
color: #fff;
}
.newscontent a.nav2 {
font-family: Verdana, sans-serif;
text-decoration: none;
font-weight: bold;
padding: 2px 9px;
background: #444;
color: #f8ef64;
}
.newscontent a.nav2:hover {
font-family: Verdana, sans-serif;
text-decoration: none;
background: #777;
font-weight: bold;
color: #fff;
}
.poster {
font-family: Verdana, sans-serif;
margin: 50px 0px 20px 0px;
padding-top: 10px;
padding-bottom: 10px;
display: block;
text-decoration: none;
font-size: 100%;
font-weight: bold;
color: #f8ef64;
border-top: 1px groove #ACACAC;
}
.poster a {
color: white;
text-decoration: none;
}
.nav body {
color: white;
background-color: #656565;
}
.nav a {
margin: 15px;
padding: 0px;
}
.nav table {
font-size: 110%;
text-align: center;
border: none;
}
.roundtop {
background: url(images/corner_topright.jpg) no-repeat top right;
}
.roundbottom {
background: url(images/corner_bottomright.jpg) no-repeat top right;
}
.banner td {
font-size: 150%;
vertical-align: top;
}
td.topleft {
background: url("images/corner_topleft.jpg") no-repeat top left;
height: 15px;
width: 15px;
}
td.topright {
background: url("images/corner_topright.jpg") no-repeat top right;
height: 15px;
width: 15px;
}
td.bottomleft {
background: url("images/corner_bottomleft.jpg") no-repeat bottom left;
height: 15px;
width: 15px;
}
td.bottomright {
background: url("images/corner_bottomright.jpg") no-repeat bottom right;
height: 15px;
width: 15px;
}
img.corner {
width: 15px;
height: 15px;
border: none;
display: block !important;
}

1
sources/config/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
ampache.cfg.php

2
sources/config/.htaccess Normal file
View file

@ -0,0 +1,2 @@
Order deny,allow
Deny from all

View file

@ -0,0 +1,816 @@
;#<?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 = 16
;###################
; Path Vars #
;###################
; The http host of your server.
; If not set, retrieved automatically from client request.
; This setting is required for WebSocket server
; DEFAULT: ""
;http_host = "localhost"
; The path to your ampache install
; Do not put a trailing / on this path
; For example if your site is located at http://localhost
; than you do not need to enter anything for the web_path
; if it is located at http://localhost/music you need to
; set web_path to /music
; DEFAULT: ""
;web_path = ""
;##############################
; Session and Login Variables #
;##############################
; Hostname of your database
; DEFAULT: localhost
database_hostname = localhost
; Port to use when connecting to your database
; DEFAULT: none
;database_port = 3306
; Name of your ampache database
; DEFAULT: ampache
database_name = ampache
; Username for your ampache database
; DEFAULT: ""
database_username = username
; Password for your ampache database, this can not be blank
; this is a 'forced' security precaution, the default value
; will not work
; DEFAULT: ""
database_password = password
; Length that a session will last expressed in seconds. Default is
; one hour.
; DEFAULT: 3600
session_length = 3600
; Length that the session for a single streaming instance will last
; the default is two hours. With some clients, and long songs this can
; cause playback to stop, increase this value if you experience that
; DEFAULT: 7200
stream_length = 7200
; This length defines how long a 'remember me' session and cookie will
; last, the default is 7200, same as length. It is up to the administrator
; of the box to increase this, for reference 86400 = 1 day
; 604800 = 1 week and 2419200 = 1 month
; DEFAULT: 86400
remember_length = 86400
; Name of the Session/Cookie that will sent to the browser
; default should be fine
; DEFAULT: ampache
session_name = ampache
; Lifetime of the Cookie, 0 == Forever (until browser close) , otherwise in terms of seconds
; If you want cookies to last past a browser close set this to a value in seconds.
; DEFAULT: 0
session_cookielife = 0
; Is the cookie a "secure" cookie? This should only be set to 1 (true) if you are
; running a secure site (HTTPS).
; DEFAULT: 0
session_cookiesecure = 0
; Auth Methods
; This defines which auth methods Auth will attempt to use and in which order.
; If auto_create isn't enabled the user must exist locally.
; DEFAULT: mysql
; VALUES: mysql,ldap,http,pam,external,openid
auth_methods = "mysql"
; External authentication
; This sets the helper used for external authentication. It should conform to
; the interface used by mod_authnz_external
; DEFAULT: none
;external_authenticator = "/usr/sbin/pwauth"
; Automatic local password updating
; Determines whether successful authentication against an external source
; will result in an update to the password stored in the database.
; A locally stored password is needed for API access.
; DEFAULT: false
;auth_password_save = "false"
; Logout redirection target
; Defaults to our own login.php, but we can override it here if, for instance,
; 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|mp4|aac|ogg|rm|wma|asf|flac|spx|ra|ape|shn|wv
catalog_file_pattern = "mp3|mpc|m4p|m4a|mp4|aac|ogg|rm|wma|asf|flac|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|flv|m4v|webm
catalog_video_pattern = "avi|mpg|flv|m4v|webm"
; 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
; will not work without this on.
; NOTE: Default Behavior is DENY FROM ALL
; DEFAULT: true
access_control = "true"
; Require Session
; If this is set to true ampache will make sure that the URL passed when
; attempting to retrieve a song contains a valid Session ID This prevents
; others from guessing URL's. This setting is ignored if you have use_auth
; disabled.
; DEFAULT: true
require_session = "true"
; Require LocalNet Session
; If this is set to true then ampache will require that a valid session
; is passed even on hosts defined in the Local Network ACL. This setting
; has no effect if access_control is not enabled
; DEFAULT: true
require_localnet_session = "true"
; Multiple Logins
; Added by Vlet 07/25/07
; When this setting is enabled a user may only be logged in from a single
; IP address at any one time, this is to prevent sharing of accounts
; DEFAULT: false
;prevent_multiple_logins = "false"
; 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
; regardless of their preferences. Requires access_control to be enabled
; DEFAULT: false
;downsample_remote = "false"
; Track User IPs
; If this is enabled Ampache will log the IP of every completed login
; it will store user,ip,time at one row per login. The results are
; displayed in Admin --> Users
; DEFAULT: false
;track_user_ip = "false"
; User IP Cardinality
; This defines how many days worth of IP history Ampache will track
; As it is one row per login on high volume sites you will want to
; clear it every now and then.
; DEFAULT: 42 days
;user_ip_cardinality = "42"
; Allow Zip Download
; This setting allows/disallows using zlib to zip up an entire
; playlist/album for download. Even if this is turned on you will
; still need to enabled downloading for the specific user you
; want to be able to use this function
; DEFAULT: false
;allow_zip_download = "false"
; File Zip Download
; This settings tells Ampache to attempt to save the zip file
; to the filesystem instead of creating it in memory, you must
; also set tmp_dir_path in order for this to work
; DEFAULT: false
;file_zip_download = "false"
; File Zip Comment
; This is an optional configuration option that adds a comment
; to your zip files, this only applies if you've got allow_zip_downloads
; DEFAULT: Ampache - Zip Batch Download
;file_zip_comment = "Ampache - Zip Batch Download"
; Waveform
; This settings tells Ampache to attempt to generate a waveform
; for each song. It requires transcode and encode_args_wav settings.
; You must also set tmp_dir_path in order for this to work
; DEFAULT: false
;waveform = "false"
; Waveform color
; The waveform color.
; DEFAULT: #FF0000
;waveform_color = "#FF0000"
; Temporary Directory Path
; If File Zip Download or Waveform is enabled this must be set to tell
; Ampache which directory to save the temporary file to. Do not put a
; trailing slash or this will not work.
; DEFAULT: false
;tmp_dir_path = "false"
; This setting throttles a persons downloading to the specified
; bytes per second. This is not a 100% guaranteed function, and
; you should really use a server based rate limiter if you want
; to do this correctly.
; DEFAULT: off
; 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 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, plus any others you've installed.
; DEFAULT: getID3 filename
metadata_order = "getID3,filename"
; Un comment if don't want ampache to follow symlinks
; DEFAULT: false
;no_symlinks = "false"
; Use auth?
; If this is set to "Yes" ampache will require a valid
; Username and password. If this is set to false then ampache
; will not ask you for a username and password. false is only
; recommended for internal only instances
; DEFAULT true
use_auth = "true"
; Default Auth Level
; If use_auth is set to false then this option is used
; to determine the permission level of the 'default' users
; default is administrator. This setting only takes affect
; if use_auth if false
; POSSIBLE VALUES: user, admin, manager, guest
; DEFAULT: admin
default_auth_level = "admin"
; 5 Star Ratings
; This allows ratings for almost any object in ampache
; POSSIBLE VALUES: false true
; DEFAULT: true
ratings = "true"
; User flags/favorites
; This allows user flags for almost any object in ampache as favorite
; POSSIBLE VALUES: false true
; DEFAULT: true
userflags = "true"
; Direct play
; This allows user to play directly a song or album
; POSSIBLE VALUES: false true
; DEFAULT: true
directplay = "true"
; Sociable
; This turns on / off all of the "social" features of ampache
; default is on, but if you don't care and just want music
; turn this off to disable all social features.
; DEFAULT: true
sociable = "true"
; Notify
; This turns on / off all Ampache notifications
; DEFAULT: true
notify = "true"
; This options will turn on/off Demo Mode
; If Demo mode is on you can not play songs or update your catalog
; in other words.. leave this commented out
; DEFAULT: false
;demo_mode = "false"
; Caching
; This turns the caching mechanisms on or off, due to a large number of
; problems with people with very large catalogs and low memory settings
; this is off by default as it does significantly increase the memory
; requirments on larger catalogs. If you have the memory this can create
; a 2-3x speed improvement.
; DEFAULT: false
;memory_cache = false
; Memory Limit
; This defines the "Min" memory limit for PHP if your php.ini
; has a lower value set Ampache will set it up to this. If you
; set it below 16MB getid3() will not work!
; DEFAULT: 32
;memory_limit = 32
; Album Art Preferred Filename
; Specify a filename to look for if you always give the same filename
; i.e. "folder.jpg" Ampache currently only supports jpg/gif and png
; Especially useful if you have a front and a back image in a folder
; comment out if ampache should search for any jpg,gif or png
; DEFAULT: folder.jpg
;album_art_preferred_filename = "folder.jpg"
; Resize Images * Requires PHP-GD *
; Set this to true if you want Ampache to resize the Album
; art on the fly, this increases load time and CPU usage
; and also requires the PHP-GD library. This is very useful
; If you have high-quality album art and a small upload cap
; DEFAULT: false
;resize_images = "false"
; Art Gather Order
; Simply arrange the following in the order you would like
; ampache to search. If you want to disable one of the search
; methods simply leave it out. DB should be left as the first
; method unless you want it to overwrite what's already in the
; database
; POSSIBLE VALUES: db tags folder amazon lastfm musicbrainz google
; DEFAULT: db,tags,folder,musicbrainz,lastfm,google
art_order = "db,tags,folder,musicbrainz,lastfm,google"
; Amazon Developer Key
; These are needed in order to actually use the amazon album art
; Your public key is your 'Access Key ID'
; Your private key is your 'Secret Access Key'
; DEFAULT: false
;amazon_developer_public_key = ""
;amazon_developer_private_key = ""
;amazon_developer_associate_tag = ""
; Recommendations
; Set this to true to enable display of similar artists or albums
; while browsing. Requires Last.FM.
; DEFAULT: false
;show_similar = "false"
; Concerts
; Set this to true to enable display of artist concerts
; Requires Last.FM.
; DEFAULT: false
;show_concerts = "false"
; Last.FM API Key
; Set this to your Last.FM api key to actually use Last.FM for
; recommendations.
;lastfm_api_key = ""
; Wanted
; Set this to true to enable display missing albums and the
; possibility for users to mark it as wanted.
; DEFAULT: false
;wanted = "false"
; Wanted types
; Set the allowed types of wanted releases (album,compilation,single,ep,live,remix,promotion,official)
; DEFAULT: album,official
wanted_types = "album,official"
; Wanted Auto Accept
; Mark wanted requests as accepted by default (no content manager agreement required)
; DEFAULT: false
;wanted_auto_accept = "false"
; EchoNest API key
; EchoNest provides several music services. Currently used for missing song 30 seconds preview.
;echonest_api_key = ""
; Broadcasts
; Allow users to broadcast music.
; This feature requires advanced server configuration, please take a look on the wiki for more information.
; DEFAULT: false
;broadcast = "false"
; Web Socket address
; Declare the web socket server address
; DEFAULT: determined automatically
;websocket_address = "ws://localhost:8100"
; Amazon base urls
; An array of Amazon sites to search.
; NOTE: This will search each of these sites in turn so don't expect it
; to be lightning fast!
; It is strongly recommended that only one of these is selected at any
; one time
; POSSIBLE VALUES:
; http://webservices.amazon.com
; http://webservices.amazon.co.uk
; http://webservices.amazon.de
; http://webservices.amazon.co.jp
; http://webservices.amazon.fr
; http://webservices.amazon.ca
; Default: http://webservices.amazon.com
amazon_base_urls = "http://webservices.amazon.com"
; max_amazon_results_pages
; The maximum number of results pages to pull from EACH amazon site
; NOTE: The art search pages through the results returned by your search
; up to this number of pages. As with the base_urls above, this is going
; to take more time, the more pages you ask it to process.
; Of course a good search will return only a few matches anyway.
; It is strongly recommended that you do _not_ change this value
; DEFAULT: 1 page (10 items)
max_amazon_results_pages = 1
; Debug
; If this is enabled Ampache will write debugging information to the log file
; DEFAULT: false
;debug = "false"
; Debug Level
; This should always be set in conjunction with the
; debug option, it defines how prolific you want the
; debugging in ampache to be. values are 1-5.
; 1 == Errors only
; 2 == Error + Failures (login attempts etc.)
; 3 == ??
; 4 == ?? (Profit!)
; 5 == Information (cataloging progress etc.)
; DEFAULT: 5
debug_level = 5
; Path to Log File
; This defines where you want ampache to log events to
; this will only happen if debug is turned on. Do not
; include trailing slash. You will need to make sure that
; the specified directory exists and your HTTP server has
; write access.
; DEFAULT: NULL
;log_path = "/var/log/ampache"
; Log filename 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"
; Charset of generated HTML pages
; Default of UTF-8 should work for most people
; DEFAULT: UTF-8
site_charset = UTF-8
; Locale Charset
; Local charset (mainly for file operations) if different
; from site_charset.
; This is disabled by default, enable only if needed
; (for Windows please set lc_charset to ISO8859-1)
; 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"
;#########################################################
; Custom actions (optional) #
;#########################################################
; Your custom play action title
;custom_play_action_title_0 = ""
; Your custom play action icon name (stored as /images/icon_[your_image].png)
;custom_play_action_icon_0 = ""
; Your custom action script, where:
; - %f: the media file path
; - %c: the excepted codec target (mp3, ogg, ...)
; - %a: the artist name
; - %A: the album name
; - %t: the song title
;custom_play_action_run_0 = ""
; Example for Karaoke playing
;custom_play_action_title_0 = "Karaoke"
;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) #
;#########################################################
; LDAP filter string to use (required)
; For OpenLDAP use "uid"
; For Microsoft Active Directory (MAD) use "sAMAccountName"
; DEFAULT: null
; ldap_filter = "sAMAccountName"
; LDAP objectclass (required)
; OpanLDAP objectclass = "*"
; MAD objectclass = "organizationalPerson"
; DEFAULT null
;ldap_objectclass = "organizationalPerson"
; Initial credentials to bind with for searching (optional)
; DEFAULT: null
;ldap_username = ""
;ldap_password = ""
; Require that the user is in a specific group (optional)
; DEFAULT: null
;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
;ldap_search_dn = "ou=People,dc=yoursubdomain,dc=yourdomain,dc=yourtld"
; This is the address of your ldap server (required)
; DEFAULT: null
;ldap_url = ""
; Attributes where additional user information is stored (optional)
; OpenLDAP ldap_name_field = "cn"
; MAD ldap_name_field = "displayname"
; DEFAULT: null
;ldap_email_field = "mail"
;ldap_name_field = "cn"
;#########################################################
; OpenID login info (optional) #
;#########################################################
; Requires specific OpenID Provider Authentication Policy
; DEFAULT: null
; VALUES: PAPE_AUTH_MULTI_FACTOR_PHYSICAL,PAPE_AUTH_MULTI_FACTOR,PAPE_AUTH_PHISHING_RESISTANT
;openid_required_pape = ""
;#########################################################
; Public Registration settings, defaults to disabled #
;#########################################################
; This setting will silently create an ampache account
; for anyone who can login using ldap (or any other login
; extension). The default is to create new users as guests
; see auto_user config option if you would like to change this
; DEFAULT: false
;auto_create = "false"
; This setting turns on/off public registration. It is
; recommended you leave this off, as it will allow anyone to
; sign up for an account on your server.
; REMEMBER: don't forget to set the mail from address further down in the config.
; DEFAULT: false
;allow_public_registration = "false"
; Require Captcha Text on Image confirmation
; Turning this on requires the user to correctly
; type in the letters in the image created by Captcha
; Default is off because its very hard to detect if it failed
; to draw, or they failed to enter it.
; DEFAULT: false
;captcha_public_reg = "false"
; This setting turns on/off admin notification of registration.
; DEFAULT: false
;admin_notify_reg = "false"
; This setting determines whether the user will be created as a disabled user.
; If this is on, an administrator will need to manually enable the account
; before it's usable.
; DEFAULT: false
;admin_enable_required = "false"
; This setting will allow all registrants/ldap/http users
; to be auto-approved as a user. By default, they will be
; added as a guest and must be promoted by the admin.
; POSSIBLE VALUES: guest, user, admin
; DEFAULT: guest
;auto_user = "guest"
; This will display the user agreement when registering
; For agreement text, edit templates/user_agreement.php
; User will need to accept the agreement before they can register
; DEFAULT: false
;user_agreement = "false"
; This disable email confirmation when registering.
; DEFAULT: false
;user_no_email_confirm = "false"
;########################################################
; These options control the dynamic downsampling based #
; on current usage #
; *Note* Transcoding must be enabled and working #
;########################################################
; Attempt to optimize bandwidth by dynamically lowering the bit rate of new
; streams. Since the bit rate is only adjusted at the beginning of a song, the
; actual cumulative bitrate for concurrent streams can be up to around
; double the configured value. It also only applies to streams that are
; transcoded.
; DEFAULT: none
;max_bit_rate = 576
; New dynamically downsampled streams will be denied if they are forced below
; this value.
; DEFAULT: 8
;min_bit_rate = 48
;######################################################
; These are commands used to transcode non-streaming
; formats to the target file type for streaming.
; This can be useful in re-encoding file types that don't stream
; very well, or if your player doesn't support some file types.
;
; 'Downsampling' will also use these commands.
;
; To state the bleeding obvious, any programs referenced in the transcode
; commands must be installed, in the web server's search path (or referenced
; by their full path), and executable by the web server.
; Input type selection
; TYPE is the extension. 'allowed' certifies that transcoding works properly for
; this input format. 'required' further forbids the direct streaming of a format
; (e.g. if you store everything in FLAC, but don't want to ever stream that.)
; transcode_TYPE = {allowed|required|false}
; DEFAULT: false
;transcode_m4a = allowed
;transcode_flac = required
;transcode_mpc = required
;transcode_ogg = required
;transcode_wav = required
;transcode_mp3 = allowed
; Default output format
; DEFAULT: none
;encode_target = mp3
; Override the default output format on a per-type basis
; encode_target_TYPE = TYPE
; DEFAULT: none
;encode_target_flac = ogg
; Allow clients to override transcode settings (output type, bitrate, codec ...)
; DEFAULT: true
transcode_player_customize = true
; Command configuration. Substitutions will be made as follows:
; %FILE% => filename
; %SAMPLE% => target sample rate
; You can do fancy things like VBR, but consider whether the consequences are
; acceptable in your environment.
; Master transcode command
; transcode_cmd should be a single command that supports multiple file types,
; such as ffmpeg or avconv. It's still possible to make a configuration that's
; equivalent to the old default, but if you find that necessary you should be
; clever enough to figure out how on your own.
; DEFAULT: none
;transcode_cmd = "ffmpeg -i %FILE%"
;transcode_cmd = "avconv -i %FILE%"
;transcode_cmd = "/usr/bin/neatokeen %FILE%"
; Specific transcode commands
; It shouldn't be necessary in most cases, but you can override the transcode
; command for specific source formats. It still needs to accept the
; encoding arguments, so the easiest approach is to use your normal command as
; a clearing-house.
; transcode_cmd_TYPE = TRANSCODE_CMD
;transcode_cmd_mid = "timidity -Or -o %FILE% | ffmpeg -f s16le -i pipe:0"
; Encoding arguments
; 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"
;######################################################
; 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
;proxy_host = "192.168.0.1"
;proxy_port = "8080"
;proxy_user = ""
;proxy_pass = ""
; If Ampache is behind an https reverse proxy, force use HTTPS protocol.
;Default: false
;force_ssl = true
;#############################
; Mail Settings #
;#############################
;Method used to send mail
;POSSIBLE VALUES: smtp sendmail php
;DEFAULT: php
;mail_type = "php"
;Mail domain.
;DEFAULT: example.com
;mail_domain = "example.com"
;This will be combined with mail_domain and used as the source address for
;emails generated by Ampache. For example, setting this to 'me' will set the
;sender to 'me@example.com'.
;DEFAULT: info
;mail_user = "info"
;A name to go with the email address.
;DEFAULT: Ampache
;mail_name = "Ampache"
;How strictly email addresses should be checked.
;easy does a regex match, strict actually performs some SMTP transactions
;to see if we can send to this address.
;POSSIBLE VALUES: strict easy none
; DEFAULT: strict
;mail_check = "strict"
;############################
; sendmail Settings #
;############################
;DEFAULT: /usr/sbin/sendmail
;sendmail_path = "/usr/sbin/sendmail"
;#############################
; SMTP Settings #
;#############################
;Mail server (hostname or IP address)
;DEFAULT: localhost
;mail_host = "localhost"
; SMTP port
;DEFAULT: 25
;mail_port = 25
;Secure SMTP
;POSSIBLE VALUES: ssl tls
;DEFAULT: none
;mail_secure_smtp = tls
;Enable SMTP authentication
;DEFAULT: false
;mail_auth = true
;SMTP Username
;your mail auth username.
;mail_auth_user = ""
; SMTP Password
; your mail auth password.
;mail_auth_pass = ""
;#############################
; Multibyte Settings #
;#############################
; 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"

View file

@ -0,0 +1,2 @@
<!-- This file contains any "Message Of The Day" Type information -->
<!-- It will be included below the log-in form on the login page. -->

View file

@ -0,0 +1 @@
**This is the plain TXT or HTML document that is put at the top of the User Registration page**

5
sources/crossdomain.xml Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

125
sources/democratic.php Normal file
View file

@ -0,0 +1,125 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
require_once 'lib/init.php';
/* Make sure they have access to this */
if (!AmpConfig::get('allow_democratic_playback')) {
UI::access_denied();
exit;
}
UI::show_header();
// Switch on their action
switch ($_REQUEST['action']) {
case 'manage':
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
$democratic->format();
case 'show_create':
if (!Access::check('interface','75')) {
UI::access_denied();
break;
}
// Show the create page
require_once AmpConfig::get('prefix') . '/templates/show_create_democratic.inc.php';
break;
case 'delete':
if (!Access::check('interface','75')) {
UI::access_denied();
break;
}
Democratic::delete($_REQUEST['democratic_id']);
$title = '';
$text = T_('The Requested Playlist has been deleted.');
$url = AmpConfig::get('web_path') . '/democratic.php?action=manage_playlists';
show_confirmation($title,$text,$url);
break;
case 'create':
// Only power users here
if (!Access::check('interface','75')) {
UI::access_denied();
break;
}
if (!Core::form_verify('create_democratic')) {
UI::access_denied();
exit;
}
$democratic = Democratic::get_current_playlist();
// If we don't have anything currently create something
if (!$democratic->id) {
// Create the playlist
Democratic::create($_POST);
$democratic = Democratic::get_current_playlist();
} else {
$democratic->update($_POST);
}
// Now check for additional things we might have to do
if ($_POST['force_democratic']) {
Democratic::set_user_preferences();
}
header("Location: " . AmpConfig::get('web_path') . "/democratic.php?action=show");
break;
case 'manage_playlists':
if (!Access::check('interface','75')) {
UI::access_denied();
break;
}
// Get all of the non-user playlists
$playlists = Democratic::get_playlists();
require_once AmpConfig::get('prefix') . '/templates/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';
break;
}
$democratic->set_parent();
$democratic->format();
require_once AmpConfig::get('prefix') . '/templates/show_democratic.inc.php';
$objects = $democratic->get_items();
Song::build_cache($democratic->object_ids);
Democratic::build_vote_cache($democratic->vote_ids);
$browse = new Browse();
$browse->set_type('democratic');
$browse->set_static_content(false);
$browse->save_objects($objects);
$browse->show_objects();
$browse->store();
break;
} // end switch on action
UI::show_footer();

View file

@ -0,0 +1,25 @@
Acknowledgements
----------
* Scott Kveton: Original creator of Ampache
* Robert Hopson
* Andy Morgan
* RosenSama
* latka
* Lamar Hansford
* Lacy Morrow
* Karl Vollmer (vollmerk)
* Paul Arthur MacIain (flowerysong)
* Chris Slamar (cslamar)
* Holger Brunn
* Kevin Purdy (purdyk)
* Charlie Smotherman (porthose)
* XGizzmo
* Spock
* Terence Theijn (pb1dft)
* Mark Kasson
* SoundOfEmotion
* Randy Perkins
* Ben Shields
* Afterster
* SUTJael

630
sources/docs/CHANGELOG.md Executable file
View file

@ -0,0 +1,630 @@
CHANGELOG
=========
3.7
----------
- Added Scrutinizer analyze
- Fixed playlist play with disabled songs (reported by stebe)
- Improved user auto-registration to optionally avoid email validation
- Fixed date.timezone php warnings breaking Ampache API (reported by redcap1)
- Fixed playlist browse with items > 1000 (reported by Tetram67)
- Fixed Amazon API Image support (thanks jbrain)
- Fixed id3v2 multiples genres (reported by Rouzax)
- Improved democratic playlist view to select the first one by default
- Improved German translation (thanks Psy-Virus)
- Fixed playlist view of all users for administrator accounts (reported by stonie08)
- Added option to regroup album disks to one album view
- Changed Ampache logo
- Fixed email validation on user registration (reported by redcap1)
- Added local charset setting
- Improved installation steps and design (thanks changi67)
- Improved Recently Played to not filter songs to one display only
- Fixed Subsonic transcoding support
- Fixed Subsonic offline storage file path (reported by Tetram76)
- Added optional top dock menu
- Added html5 web audio api visualizer and equalizer
- Added `Play List` to localplay mode
- Fixed encoding issue in batch download
- Added pagination to democratic playlists
- Added an option to group albums discs to an unique album
- Added alphabeticalByName and alphabeticalByArtist browse view in Subsonic API
- Fixed album art on xspf generated playlist
- Added stats, playlist and new authentication method to Ampache XML API
- Added responsive tables to automatically hide optional information on small screen
- Added song action buttons (user favorite, rating, ...) to the web player
- Added sortable capability to the web player playlist
- Added Growl notification/scrobbler plugin
- Added artist slideshow photos plugin from Flickr
- Added setting to change Ampache log file name
- Added playlists to Quick and Advanced search
- Added pls, asx and xspf playlist file format import
- Fixed playlist import with song file absolute path (reported by ricksorensen)
- Fixed playlist import with same song file names (reported by captainark)
- Added shoutcast notification at specific time when playing a song with a waveform
- Added Tag edit/delete capability
- Added several search engine links
- Added myPlex support on Plex API
- Added cache on LastFM data
- Added custom buttons play actions
- Added artist pictures slideshow for current playing artist
- Added Broadcast feature
- Added Channel feature with Icecast compatibility
- Replaced Muses Radio Player by jPlayer to keep one web player for all
- Added missing artists in similar artists for Wanted feature
- Added concerts information from LastFM
- Added tabs on artist information
- Added 'add to playlist' direct button on browse items
- Added avatar on users and Gravatar/Libravatar plugins
- Fixed playlist visibility (reported by stonie08)
- Added OpenID authentication
- Fixed m3u import to playlist on catalog creation (reported by jaydoes)
- Improved missing/wanted albums with the capability to browse missing artists
- Added share feature
- Updated French translation
- Added options per browse view (alphabetic, infinite scroll, number of items per page...)
- Fixed several Subsonic players (SubHub, Jamstash...)
- Added option to get beautiful stream url with url rewriting
- Added check to use a new thread for scrobbling if available
- Added confirmation option when closing the currently playing web player
- Added auto-pause web player option between several browse tabs
- Fixed similar artists list with disabled catalogs (reported by stebe)
- Improved Shoutbox (css fix, real time notifications...)
- Fixed iframe basket play action reload
- Fixed wanted album auto-remove
- Fixed MusicBrainz get album art from releases
- Added Waveform feature on songs
- Added AutoUpdate Ampache version check
- Added auto-completion in global Ampache search
- Added option to 'lock' header/sidebars UI
- Fixed catalog export when 'All' selected
- Fixed XBMC Local Play (reported by nakinigit)
- Fixed artist search
- Fixed Random Advanced (reported by stebe)
- Changed song preview directplay icons
- Added Headphones Automatic Music Downloader support as a 'Wanted Process' plugin
- Updated PHPMailer to version 5.2.7
- Updated getID3 to version 1.9.7
- Added 'Song Preview' feature on missing albums tracks, with EchoNest api
- Added 'Missing Albums' / 'Wanted List' feature
- Upgraded to MusicBrainz api v2
- Replaced Snoopy project with Requests project
- Added user-agent on recently played
- Added option to show/hide recently played, time and user-agent per user
- Updated French language
- Added option for iframe or popup web player mode
- Improved Song/Video web player with jPlayer, Radio player with Muse Radio Player
- Added 'add media' to the currently played playlist on web player
- Added dedicated 'Recently Played' page
- Added enable/disable feature on catalogs
- Fixed Config class conflict with PEAR
- Improved recommended artists/songs loading using ajax
- Added a new modern 'Reborn' theme
- Improved Subsonic api backend support (json, ...)
- Added Plex api backend support
- Added artist art/summary when using LastFM api
- Added 'all' link when browsing
- Added option to enable/disable web player technology (flash / html5)
- Fixed artist/song edition
- Improved tag edition
- Added song re-order on album / playlists
- Replaced Prototype with jQuery
- Added 'Favorite' feature on songs/albums/artists
- Added 'Direct Play' feature to play songs without using a playlist
- Added Lyrics plugins (ChartLyrics and LyricWiki)
- Fixed ShoutBox enable/disable (reported by cipriant)
- Added SoundCloud, Dropbox, Subsonic and Google Music catalog plugins
- Improved Catalogs using plug-ins
- Added browse paging to all information pages
- Fixed LDAP authentication with password containing '&' (reported by bruth2)
- Added directories to zip archives
- Improved project code style and added Travis builds
- Added albums default sort preference
- Added number of times an artist/album/song was played
- Fixed installation process without database creation
- Removed administrative flags
3.6-FUTURE
----------
- Fixed issue with long session IDs that affected OS X Mavericks and possibly
other newer PHP installations (reported by yebo29)
- Fixed some sort issues (patch by Afterster)
- Fixed Fresh theme display on large screens (patch by Afterster)
- Fixed bug that allowed guests to add radio stations
- Added support for aacp transcoding
- Improved storage efficiency for large browse results
- Fixed unnecessary growth of the tmp_browse table from API usage (reported
by Ondalf)
- Removed external module 'validateEmail'
- Updated PHPMailer to 5.2.6
3.6-alpha6 *2013-05-30*
-----------------------
- Fixed date searches using 'before' to use the correct comparison
(patch by thinca)
- Fixed long-standing issue affecting Synology users (patch by NigridsVa)
- Added support for MySQL sockets (based on patches by randomessence)
- Fixed some issues with the logic around memory_limit (reported by CableNinja)
- Fixed issue that sometimes removed ratings after catalog operations (reported
by stebe)
- Fixed catalog song stats (reported by stebe)
- Fixed ACL text field length to allow entry of IPv6 addresses (reported
by Baggypants)
- Fixed regression preventing the use of an existing database during
installation (reported by cjsmo)
- Fixed operating on all catalogs via the web interface
(reported by orbisvicis)
- Added support for nonstandard database ports
- Updated getID3 to 1.9.5
- Improved the performance of stream playlist creation (reported by AkbarSerad)
- Fixed "Pure Random" / Random URLs (reported by mafe)
3.6-alpha5 *2013-04-15*
----------------------
- Fixed persistent XSS vulnerability in user self-editing (reported by
Jean-Lou Hau)
- Fixed persistent XSS vulnerabilities in AJAX object editing (reported by
Jean-Lou Hau)
- Fixed character set detection for ID3v1 tags
- Added matroska to the list of known tag types
- Made the getID3 metadata source work better with tag types that Ampache
doesn't recognise
- Switched from the deprecated mysql extension to PDO
- stderr from the transcode command is now logged for debugging
- Made database updates more robust and verified that a fresh 3.3.3.5 import
will run through the updates without errors
- Added support for external authenticators like pwauth (based on a patch by
sjlu)
- Renamed the local auth method to pam, which is less confusing
- Removed the Flash player
- Added an HTML5 player (patch by Holger Brunn)
- Changed the way themes handle RTL languages
- Fixed a display problem with the Penguin theme by adding a new CSS class
(patch by Fred Thomsen)
- Made transcoding and its configuration more flexible
- Made transcoded streams more standards compliant by not sending a random
value as the Content-Length or claiming that ranged requests are
supported
- Changed rating semantics to distinguish between user ratings and the
global average and add the ability to search for unrated items
(< 1 star)
- Updated Prototype to git HEAD (4ce0b0f)
- Fixed bug that disclosed passwords for plugins to users that didn't
have access to update the password (patch by Fred Thomsen)
- Fixed streaming on Android devices and anything else that expects to
be able to pass a playlist URL to an application and have it work
- Removed the SHOUTcast localplay controller
3.6-Alpha4 *2012-11-27*
-----------------------
- Removed lyric support, which was broken and ugly
- Removed tight coupling to the PHP mysql extension
- Fixed an issue with adding catalogs on Windows caused by inconsistent
behaviour of is_readable() (reported by Lockzi)
3.6-Alpha3 *2012-10-15*
-----------------------
- Updated getID3 to 1.9.4b1
- Removed support for extremely old passwords
- Playlists imported from M3U now retain their ordering
(patch by Florent Fourcot)
- Removed HTML entity encoding of plaintext email (reported by USMC Guy)
- Fixed a search issue which prevented the use of multiple tag rules
(reported by Istarion)
- Fixed ASF tag parsing regression (reported by cygn)
3.6-Alpha2 *2012-08-15*
-----------------------
- Fixed CLI database load to work regardless of whether it's run from
the top-level directory (reported by porthose)
- Fixed XML cleanup to work with newer versions of libpcre
(patch by Natureshadow)
- Fixed ID3v2 disk number parsing
- Updated getID3 to 1.9.3
- Added php-gettext for fallback emulation when a locale (or gettext) isn't
supported
- Fixed pluralisation issue in Recently Played
- Added support for extracting MBIDs from M4A files
- Fixed parsing of some tag types (most notably M4A)
- Corrected PLS output to work with more players (reported by bhassel)
- Fixed an issue with compound artists in media with MusicBrainz tags
(reported by greengeek)
- Fixed an issue with filename pattern matching when patterns contained
characters that are part of regex syntax (such as -)
- Fixed display of logic operator in rules (reported by Twister)
- Fixed newsearch issue preventing use of more than 9 rules
(reported by Twister)
- Fixed JSON escaping issue that broke search in some cases
(reported by XeeNiX)
- Overhauled CLI tools for installation and database management
- Fixed admin form issue (reported by the3rdbit)
- Improved efficiency of fetching song lists via the API
(reported by lotan_rm)
- Added admin_enable_required option to user registration
- Fixed session issue preventing some users from streaming
(reported by miir01)
- Quote Content-Disposition header for art, fixes Chrome issue
(patch by Sébastien LIENARD)
- Fixed art URL returned via the API (patch by lotan_rm)
- Fixed video searches (reported by mchugh19)
- Fixed Database Upgrade issue that caused catalog user/pass for
remote catalogs to not be added correctly
- Added the ability to locally cache passwords validated by external
means (e.g. to allow LDAP authenticated users to use the API)
- Fixed session handling to actually use our custom handler
(reported by ss23)
- Fixed Last.FM art method (reported by claudio)
- Updated Captcha PHP to 2.3
- Updated PHPMailer to 5.2.0
- Fixed bug in MPD module which affected toggling random or repeat
(patch from jherold)
- Properly escape config values when writing ampache.cfg.php
- Fixed session persistence with auth disabled (reported by Nathanael
Anderson)
- Fixed item count retention for Advanced Random (reported by USAF_Pride)
- Made catalog verify respect memory_cache
- Some catalog operations are now done in chunks, which works better on
large catalogs
- API now returns year and bitrate for songs
- Fixed search_songs API method to use Search::run properly
- Fixed require_session when auth_type is 'local'
- Catalog filtering fix
- Toggle artwork with a button instead of a checkbox (patch from mywindow)
- API handshake code cleanup, including a bugfix from postfuturist
- Improved install process when JavaScript is disabled
- Fixed duplicate searching even more
- Committed minor bugfixes for Penguin theme
- Added Fresh theme
- Fixed spurious API handshake failure output
3.6-Alpha1 *2011-04-27*
-----------------------
- Fixed forced transcoding
- Fixed display during catalog updates (reported by Demonic)
- Fixed duplicate searching (patch from Demonic)
- Cleaned up transcoding assumptions
- Fixed tag browsing
- Added new search/advanced random/dynamic playlist interface
- byterange handling for ranges starting with 0 (patch from uberbrady)
- Fixed issue with updating ACLs under Windows (reported by Citlali)
- Add function that check ampache and php version from each website.
- Updated each ampache header comment based on phpdocumentor.
- Fixed only admin can browse phpinfo() for security reasons on /info.php
- Added a few translation words.
- Updated version 3.6 on docs/*
- Implemented ldap_require group (patch from eliasp)
- Fix \ in web path under Apache + Windows Bug #135
- Partial MusicBrainz metadata gathering via plugin
- Metadata code cleanup, support for plugins as metadata sources
- New plugin architecture
- Fixed display charset issue with catalog add/update
- Fixed handling of temporary playlists with >100 items
- Changed Browse from a singleton to multiple instances
- Fixed setting access levels for plugin passwords
- Fixed handling of unusual characters in passwords
- Fixed support for requesting different thumbnail sizes
- Added ability to rate Albums of the Moment
- Added ability to edit/delete playlists while they are displayed
- Fix track numbers not being 0 padded when downloading or renaming.
- Rating search now allows specification of operator (>=, <=, or =)
and uses the same ratings as normal display.
- Add -t to catalog_update.inc for generating thumbnails
- Generate Thumbnails during catalog art operations
- Fixed transcode seeking of Flacs by switching to MM:SS format for
flacs being transcoded
- Change album_art_order to art_order to reflect general nature of
config option
- Fix PHP warning with IP History if no data is found.
- Add -g flag to catalog update to allow for art gathering via cmdline
- Change Update frequency of catalog display to 1 second rather then
%10 reduces cpu load due to javascript excution (Thx Dmole)
- Add bmp to the list of allowed / supported album art types
- Strip extranious whitespace from cmdline catalog update (Thx ascheel)
- Fix catalog size math for catalogs up to 4TB (Thx Joost.t.Hart@planet.nl)
- Fix httpq not correctly skipping to new song
- Fix refreshing of localplay playlist when an item is skipped to
- Fix missing Content-Disposition filename= on non-transcoded songs
- Fix refresh of localplay playlist when you delete a track from it
- Added ability to add Ampache as a search descriptor (Thx Vlet)
- Correct issue with single song downloads
- Removed old useless files
- Added local auth method that uses PHP's PAM module
- Correct potential security issues due to misuse of REQUEST for write
operations rather then POST (Thx Raphael Geissert <geissert@debian.org>)
- Finished switching to Dba::read() Dba::write() for database calls
(Thx dipsol)
- Improved File pattern matching (Thx october.rust)
- Updated Amazon Album art search to current Amazon API specs (Thx Vlet)
- Fix typo that caused song count to not be set on tag xml response
- Fix tag methods so that alpha_match and exact_match work
- Fix limit and offset not working on search_songs API method
- Fix import m3u on catalog build so it does something
- Fix inconsistent view during catalog operations
- Sort malformed files into "Unknown (Broken)" rather then leaving
them in "Unknown (Orphaned)"
- Fix API democratic voting methods (Thx kindachris)
- Add server version to API ping response
- Fix Localplay API methods (Thx thomasa)
- Improve bin/catalog_update.inc to allow only verify, clean or add
(Thx ascheel)
- Fix issue with batch download and UNC paths (Thx greengeek)
- Added config option to turn caching on/off, Default is off
- Fix issue where file tag pattern was ignore if files have no tag structure
- Add TDRC to list of parsed id3v2 tags
- Added the rating to a single song view
- Fix caching issue when updating ratings where they would not
display correctly until a page reload
- Altered the behavior of adding to playlists so that it maintains
playlist order rather then using track order
- Strip excessive \n's from catalog_update (Thx ascheel)
- Fix incorrect default ogg transcode target in base config file
- Fix stream user preferences using cached system preferences
rather then their own
- Fixed prevent_multiple_logins preventing all logins (Thx Hugh)
- Added additional information to installation process
- Fix PHP 5.3 errors (Thx momo-i)
- Fix random methods not working for localplay
- Fixed extra space on prefixed albums (Thx ibizaman)
- Add missing operator on tag and rating searches so they will
work with other methods (Thx kiehnet@netscape.net)
- Add MusicBrainz MBID support to uniqly identify albums and
also get more album art (Thx flowerysong)
- Fix the url to song function
- Add full path to the files needed by the installation just to
make it a little clearer
- Fixed potential endless loop with malformed genre tags in mp3s
(Thx Bernhard Weyrauch)
- Fixed web path always returning false on /test.php
- Updated Man Page to fix litian problems for Debian packaging
- Fixed bug where video was registering as songs for now playing
and stats
- Add phpmailer and change ampache.cfg.php.dist
- Fixed manpage (Thx Porthose)
3.5 *2009-05-05*
----------------
- Added complete Czech translation (Thx martin hason)
- Add the AlmightyOatmeal-Sanity check to prevent a clean from
removing all songs if your mount failed, but is still
readable by ampache
- Make the Lang Install page prettier
- Added Check for hash,inet_pton,windows PHP Version to init so
that upgrades without pre-reqs are handled correctly
- Allow mms,mmsh,mmsu,mmst,rstp in Radio Stream URLs
- Fixed a problem where after adding a track to a saved playlist
there was no UI response upon deleting the track without
a page refresh
- Fix an issue where the full version of the album art was never
used even when requested
- Fix maxlength on acl fields being to small for all IPv6 addresses
- Add error message when file exists but is unreadable do not
remove unreadable songs from catalog
- Fixed missing title tag on song browse for the title
(Thx flowerysong)
- Fix htmlchar'd rss feed url
- Fix Port not correctly being added to URL in most cases
even when defined in config
v.3.5-Beta2 04/07/2009
- Fix ASX playlists so more data shows up in WMP (Thx Jon611)
- Fix dynamic playlist items so they work in stream methods again
- Fixed Recently played so that it correctly shows unique songs
with the correct data
- Fix some issues with filenames with Multi-byte characters
(Thx Momo-i)
- Add WMV/MPG specific parsing functions (Thx Momo-i)
- Add text to /test.php for hash() and SHA256() support under PHP
section
- Fix SHA256 Support so that it references something that exists
- Fix incorrect debug_event() on login due to typo
- Remove manage democratic playlist as it has no meaning in the
current version
- Run Dba::reset_db_charset() after upgrade in case people are playing
hot potato with their charsets.
- Move Server Preferences to Admin menu (Thx geekdawg)
- Fixed missing web_path reference on radio creation link
- Fixed remote catalog_clean not working
- Fixed xmlrpc get image. getEncoding wasn't static
3.5-Beta1 *2009-03-15*
----------------------
- Add democratic methods to api, can now vote, devote, get url
and the current democratic playlist through the api
- Revert to old Random Play method
- Added proxy use for xmlrpcclient
- Added Configuration 'Wizard' for democratic play
- Fixed interface feedback issues with democratic play actions
- Add extension to image urls for the API will add to others as
needed due to additional query requirement. Needed to fix
some DLNA devices
- Fixed typo that caused the height of album art not to display
- Modified database and added GC for tmp_browse table
- Added get lyrics and album art using http proxy server #313 + username,
password patch
- Added lyricswiki link Ticket #70
- Updated README language
- Updated getid3 library 2.0.0b4 to 2.0.0b5
- Make the Democratic playlist be associated with the user
who sends it to a 'player'
- Fixed missing page headers on democratic playlist
- Show who voted for the sogns on democratic playlist
- Increase default stream length to account for the fact that movies
are a good bit longer then songs
- Correct Issues with multi-byte characters in Lyrics (Thx Momo-i)
- Added caching to Video
- Added Video calls to the API
- Remove redundent code from Browse class by making it extend
nwe Query class
- Update Prototype to 1.6.0.3
- Add Time range to advanced search
- Add sorting to Video Browse
- Changed to new Query backend for Browsing and Dynamic Playlists
3.5-Alpha2 *2009-03-08*
-----------------------
- Fixed caching of objects with no return value
- Fixed updating of songs that should not be updated during catalog
verify
- Added default_user_level config option that allows you to define
the user level when use_auth is false. Also allows manual
login of admin users when use_auth is false.
- Fix Version checking and Version Error Message on install (Thx Paleo)
- Moved Statistics to main menu, split out newest/popular/stats
- Fixed bug where saved Thumbnails were almost never used
- Fixed Localplay HTTPQ and MPD controls to reconize Live Stream
urls.
- Added Localplay controls to API
- Added Added/Updated filters to API include the ability to specify
a date range using ISO 8601 format with [START]/[END]
- Changed API Date format to ISO 8601
- Fixed Incorrect Caching of Album records that caused the
Name + Year + Disk to not be respected
- Added Lyrics Patch (Thx alister55 & momo-i)
- Fixed password not updating when editing an HTTPQ localplay
instance
- Added Video support
- Fixed normalize tracks not re-displaying playlist correctly
- Fixed now playing now showing currently playing song
- Fixed now playing clear all not correctly refreshing screen
- Fixed adding object to playlist so that it correctly shows the
songs rather then an empty playlist
- Added User Agent to IP History information gathering
- Added Access Control List Wizards to make API interface
setup easier
- Added IPv6 support for Access Control, Sessions, IP History
- Fixed sorting issue on artist when using search method
- Updated flash player to 5.9.5
- Fixed bug where you admins couldn't edit preferences of
users due to missing 'key' on form
- Added Mime type to Song XML
3.5-Alpha1 *2008-12-31*
-----------------------
- Fixed sort_files script so that it properly handles variable
album art file names in the directories
- Fixed issue where small thumbnails were used for larger images
if gd based resizing was enabled in the config
- Fixed catalog_update.inc so it doesn't produce errors
- Made democratic play respect force http play
- Make installation error messages more helpful
- Added Swedish (sv_SE) translation (Thanks yeager)
- Allow Add / Verify of sub directories of existing catalogs
- Prevent an fread of 0 bytes if you seek to the end of a file
- Added require_localnet_session config that allows you to exclude
IP(s) from session checks, see config.dist
- Added Nusoap (http://sourceforge.net/projects/nusoap/) library
for use with future lyrics feature
- Fixed problem with flash player where random urls were not being
added correctly
- Fixed problem with user creation using old method (Thx Purdyk)
- Switched to SHA256() for API and Passwords
- Added check for BADTIME error code from Last.FM and correctly
return the error rather then a generic one
- Fix http auth session issues, where every request blew away the
old session information
- Many other minor improvements (Thx Dipsol)
- Fixed warnings in caching code (Thx Dipsol)
- Massive text cleanup (Thx Dipsol)
- Fixed tag searching and improved some other search methods to
prevent SQL warnings on no results
- Improved Test page checks to more accuratly verify putENV support
- Make network downsampling a little more sane, don't require
access level
- Added caching to Playlist dropdown
- Fixed double caching on some objects
- Added base.css and 4 tag 'font' sizes depending on weight/count
- Fixed inline song edit
- Updated registration multi-byte mail.
- Fixed vainfo.class.php didn't catch exception for first analyze.
- Fixed iconv() returns an empty strings (Thx abs0)
- Updated getid3 for multi-byte characters, but some wrong id3tags
have occurred exception error.
- Fixed use_auth = false not correctly re-creating the session if
you had just switched from use_auth = true
- Add links to RSS feeds and set default to TRUE in config.dist
- Fixed Dynamic Random/Related URLs with players that always send
a byte offset (MPD)
- Added Checkbox to use existing Database
- Updated language code and Fixed catalan language code
- Added Emulate gettext() from upgradephp-15
(http://freshmeat.net/p/upgradephp)
- Fixed Test.php parse error.
- Updated multibyte character strings mail.
- Fixed To send mail don't remove the last comma from recipient.
- Updated More translatable templates.
- Removed merge-messages.sh and Add LANGLIST (each languages
translation statistics).
- Fixed If database name don't named ampache, can't renamed tags
to tag.
- Fixed count issue on browse Artists (Thx Sylvander)
- Fixed prevent_multiple_logins, preventing all logins (Thx hugh)
- Fixed Export catalog headers so it corretly prompts you to download
the file
- Add ability to sort by artist name, album name on song browse
- Implemented caching on artist and album browse, added total
artist time to the many artist view
- Fixed test config page so it bounces you back to the test page
if the config starts parsing correctly
- Fixed browsing so that you can browse two different types in two
windows at the same time
- Improved gather script for translations (Thx momo-i)
- Added paging to the localplay playlist
- Updated German Translation (Thx Laurent)
- Fixed issue where Remote songs would never be removed from
the democratic playlist
- Fixed issue where user preferences weren't set correctly
on stream (Thx lorijho)
- Added caching of user preferences to avoid a SQL query on load
(Thx Protagonist)
- Fixed home menu not always displaying the entire contents
- Fixed logic error with duplicate login setting which caused it
to only work if mysql auth was used
- Changed Passwords to SHA1 will prompt to reset password
- Corrected some translation strings and added jp_JP (Thx momo-i)
- Ignore filenames that start with . (hidden) solves an issue
with mac filesystems
- Fix tracking of stats for downloaded songs
- Fix divide by 0 error during transcode in some configurations
- Remove root mysql pw requirement from installer
- Added Image Dimensions on Find Album Art page
- Added Confirmation Screen to Catalog Deletion
- Reorganized Menu System and Added Modules section
- Fix an error if you try to add a shoutbox for an invalid object
(Thx atrophic)
- Fixed issue with art dump on jpeg files (Thx atrophic)
- Fixed issue with force http play and port not correctly specifying
non-standard http port (Thx Deathcrow)
- Remember Starts With value even if you switch tabs
- Fixed rating caching so it actually completely works now
- Removed redundent UPDATE on session table due to /util.php
- Added Batch Download to single Artist view
- Added back in the direct links on songs, requires download set
to enabled as it's essentially the same thing except with
now playing information tied to it
- Bumped API Version to 350001 and require that a version is sent
with handshake to indicate the application will work
- Removed the MyStrands plugin as did not provide good data, and does
not appear to have been used
- Added Catalog Prefix config option used to determine which prefixes
should not be used for sorting
- Merged Browse Menu with Home
- Added checkbox to single artist view allowing you to enable/disable
album art thumbnails on albums of said artist
- Added timeout override on update_single_item because the function
is a lie
- Fix translations so it's not all german
- Genre Tag is now used as a 'Tag', Browse Genre removed
- Ignore getid3() iconv stuff doesn't seem to work
- Improved fix_filenames.inc, tries a translation first then strips
invalid characters
- Fixed album art not clearing thumbnail correctly on gather
- Fixed localplay instance not displaying correctly after change
until a page refresh
- Fixed endless loop on index if you haven't played a song in
over two years
- Fixed gather art and parse m3u not working on catalog create
also added URL read support to m3u import
- Upped Minimum requirements to Mysql 5.x
- Add codeunde1load's Web 2.0 style tag patch
- Fixed typo in e-mail From: name (Thx Xgizzmo)
- Fixed typo in browse auto_init() which could cause ampache to not
remember your start point in some situations. (Thx Xgizzmo)

280
sources/docs/GPL-LICENSE Executable file
View file

@ -0,0 +1,280 @@
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

35
sources/docs/PLUGINS Normal file
View file

@ -0,0 +1,35 @@
-------------------------------------------------------------------------------
----------------- PLUGINS - Ampache v.3.6 ----------------------
-------------------------------------------------------------------------------
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
corresponding class and the name of the class must be prefixed with
Ampache, e.g. AmpacheDummy.
The following public variables must be declared:
name (string)
description (string)
version (int) - This plugin's version
min_ampache (int) - Minimum Ampache DB version required
max_ampache (int) - Maximum Ampache DB version supported
The following public methods must be implemented:
install
uninstall
load
The following public methods may be implemented:
upgrade
Finally, for the plugin to actually be useful one or more of the following hooks
should be implemented as a public method:
get_metadata(Array $metadata)
The passed array contains the best metadata we've got.
save_rating(Rating $rating, int $new_value)
save_songplay(Song $song)
get_lyrics(Song $song)
process_wanted(Wanted $wanted)
shortener(string $url)
get_photos(string $search)

View file

@ -0,0 +1,119 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.TH "AMPACHE" "1" "December 27, 2008" "Karl Vollmer" "Sound"
.SH "NAME"
Ampache \- is a Web\-based Audio file manager.
.SH "DESCRIPTION"
Ampache is implemented with MySQL, and PHP. It allows you to view, edit, and
play your audio files via the web. It has support for playlists, artist and album
views, album art, random play, playback via Http, on the Fly Transcoding and
Downsampling, Vote based playback, Mpd and Icecast, Integrated Flash Player, as
well as per user themes and song play tracking. You can also Link multiple Ampache
servers together using XML\-RPC. Ampache supports GETTEXT translations and has a
full translation of many languages.
.SH "OPTIONS"
The following scripts are included in Ampache and can be used to automate some
aspects of Ampache.
catalog_update.inc
You can automate the update of all, or some of your local catalogs by using the
bin/catalog_update.inc file. By default this will run a clean, verify and update
on all of your local catalogs. You can optionally specify the name of the catalog
and it will only update the specified catalog. Very useful when used with cron or
crontab.
dump_art.inc
You can output all of the album art stored in ampache to the filesystem. It will
output the image stored in the database to the directory of the first file in the
album. This can cause problems f your files are not in their own directories. You
can specify the filename to be written by modifying the config file options
relating to album_art_preferred_filename. Ampache will by default output meta
data directory files for linux.
delete_disabled.inc
If you would like to delete all of the disabled songs in Ampache you can run the
bin/delete_disabled.inc to delete all of the songs that are disabled in Ampache.
Naturally this requires the user you run the script as to have permissions to
delete the files in question. By default this script will not work if you run
it. You must open it and delete or comment out the line that says $debug=true
for it to actually work.
sort_files.inc
You can have Ampache automatically rename and move all of your files based
on the meta data in Ampache using the bin/sort_files.inc script. This requires
write access to the files in question. The files will be renamed and moved based
on their respective File and Folder patterns as defined by the catalog. Ampache
will also by default sort your files into A\-Z sub\-folders to reduce the number
of folders at the top level. You can turn this off by editing the file and setting the
$alphabet_prefix to false, or commenting it out.
fix_filenames.inc
Ampache provides some additional tools to help you cope with Character set
mis\-matches. These scripts must be run from the command line. After making
any changes to your tags or the filenames please make sure you update your
catalog and that your local client has the character set and fonts required to
display the tag information. This script looks through the path of your local catalogs
for filenames who contain characters that do not exist in the currently configured
site_charset. It will prompt you for a source character charset, if none is
specified it will use the current output_encoding value from iconv().
print_tags.inc
You can also look at the raw tags inside a file by running the included
print_tags.inc file. This example takes advantage of the hexcat application to get
the hex values of the output. You will need to compare the reported HEX value to
the HEX value according to the defined charset.
.PP
php /bin/print_tags.inc [FILE]
.br
.PP
migrate_config.inc
This is used to migrate your ampache.cfg.php config file from php4 formating to php5
formating. This is done to decrease the parsing time of ampache.cfg.php. This is
generally not needed unless you are upgrading from 3.3.3.5 to 3.4.x.
debian/ampache.postinst runs this script automatically if needed.
.SH "EXAMPLES"
php /usr/share/ampache/www/bin/update_catalog.inc\c
.br
php /usr/share/ampache/www/bin/print_tag.inc \ [path to music file]\c
.br
.SH "FILES"
/usr/share/ampache/www/bin
.SH "SEE ALSO"
/usr/share/doc/ampache/README.Debian.gz\c
.br
/usr/share/doc/ampache/README.gz\c
.br
http://ampache.org/wiki\c
.br
.SH "AUTHOR"
Ampache was written by Karl Vollmer <vollmer@ampache.org>\c
.PP
This manual page was written by Charlie Smotherman\c
.br
<cjsmo@cableone.net>, for the Debian project and Karl Vollmer.

BIN
sources/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

135
sources/image.php Normal file
View file

@ -0,0 +1,135 @@
<?php
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
*
* LICENSE: GNU General Public License, version 2 (GPLv2)
* Copyright 2001 - 2014 Ampache.org
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/**
* Album Art
* This pulls album art out of the file using the getid3 library
* and dumps it to the browser as an image mime type.
*
*/
// This file is a little weird it needs to allow API session
// this needs to be done a little better, but for now... eah
define('NO_SESSION','1');
require_once 'lib/init.php';
// Check to see if they've got an interface session or a valid API session, if not GTFO
if (!Session::exists('interface', $_COOKIE[AmpConfig::get('session_name')]) && !Session::exists('api', $_REQUEST['auth'])) {
debug_event('image','Access denied, checked cookie session:' . $_COOKIE[AmpConfig::get('session_name')] . ' and auth:' . $_REQUEST['auth'], 1);
exit;
}
// If we aren't resizing just trash thumb
if (!AmpConfig::get('resize_images')) { $_GET['thumb'] = null; }
// FIXME: Legacy stuff - should be removed after a version or so
if (!isset($_GET['object_type'])) {
$_GET['object_type'] = 'album';
}
$type = Art::validate_type($_GET['object_type']);
/* Decide what size this image is */
switch ($_GET['thumb']) {
case '1':
/* This is used by the now_playing stuff */
$size['height'] = '75';
$size['width'] = '75';
break;
case '2':
$size['height'] = '128';
$size['width'] = '128';
break;
case '3':
/* This is used by the flash player */
$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;
$size['width'] = 32;
break;
default:
$size['height'] = '275';
$size['width'] = '275';
if (!isset($_GET['thumb'])) { $return_raw = true; }
break;
} // define size based on thumbnail
$image = '';
$mime = '';
$filename = '';
$typeManaged = false;
if (isset($_GET['type'])) {
switch ($_GET['type']) {
case 'popup':
$typeManaged = true;
require_once AmpConfig::get('prefix') . '/templates/show_big_art.inc.php';
break;
case 'session':
// If we need to pull the data out of the session
Session::check();
$filename = scrub_in($_REQUEST['image_index']);
$image = Art::get_from_source($_SESSION['form']['images'][$filename], 'album');
$mime = $_SESSION['form']['images'][$filename]['mime'];
$typeManaged = true;
break;
}
}
if (!$typeManaged) {
$media = new $type($_GET['id']);
$filename = $media->name;
$art = new Art($media->id,$type);
$art->get_db();
if (!$art->raw_mime) {
$mime = 'image/jpeg';
$image = file_get_contents(AmpConfig::get('prefix') .
AmpConfig::get('theme_path') .
'/images/blankalbum.jpg');
} else {
if ($_GET['thumb']) {
$thumb_data = $art->get_thumb($size);
}
$mime = isset($thumb_data['thumb_mime']) ? $thumb_data['thumb_mime'] : $art->raw_mime;
$image = isset($thumb_data['thumb']) ? $thumb_data['thumb'] : $art->raw;
}
}
if (!empty($image)) {
$extension = Art::extension($mime);
$filename = scrub_out($filename . '.' . $extension);
// Send the headers and output the image
$browser = new Horde_Browser();
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 604800));
$browser->downloadHeaders($filename, $mime, true);
echo $image;
}

BIN
sources/images/ampache.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

BIN
sources/images/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
sources/images/icon_add.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 703 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

BIN
sources/images/icon_all.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 612 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

BIN
sources/images/icon_cog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 814 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 655 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 715 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 691 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

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