From 1405ad7d317f59478fa84437329c0203911581ab Mon Sep 17 00:00:00 2001 From: Adam Lavin <adam@lavoaster.co.uk> Date: Thu, 17 Dec 2015 00:14:46 +0000 Subject: [PATCH 1/9] Proof-of-concept for SEO meta updates in angular #27 --- resources/assets/scripts/app/app.coffee | 8 ++++++++ resources/assets/scripts/app/controllers/album.coffee | 5 +++-- resources/assets/scripts/app/controllers/playlist.coffee | 5 +++-- resources/assets/scripts/app/controllers/track.coffee | 5 +++-- resources/views/shared/_layout.blade.php | 6 +++--- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/resources/assets/scripts/app/app.coffee b/resources/assets/scripts/app/app.coffee index f9c891ea..15de84a4 100644 --- a/resources/assets/scripts/app/app.coffee +++ b/resources/assets/scripts/app/app.coffee @@ -25,6 +25,13 @@ if window.pfm.environment == 'production' analytics.init() ] +module.run [ + '$rootScope', + ($rootScope) -> + $rootScope.$on '$stateChangeStart', (event, toState, toParams, fromState, fromParams) -> + $rootScope.description = '' +] + module.config [ '$locationProvider', '$stateProvider', '$dialogProvider', 'AngularyticsProvider', '$httpProvider', '$sceDelegateProvider' (location, state, $dialogProvider, analytics, $httpProvider, $sceDelegateProvider) -> @@ -283,4 +290,5 @@ module.config [ $dialogProvider.options dialogFade: true backdropClick: false + ] diff --git a/resources/assets/scripts/app/controllers/album.coffee b/resources/assets/scripts/app/controllers/album.coffee index 8c816d91..387a2bd9 100644 --- a/resources/assets/scripts/app/controllers/album.coffee +++ b/resources/assets/scripts/app/controllers/album.coffee @@ -21,13 +21,14 @@ window.pfm.preloaders['album'] = [ ] angular.module('ponyfm').controller "album", [ - '$scope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout' - ($scope, albums, $state, playlists, auth, $dialog, cachedAlbum, $window, $timeout) -> + '$scope', '$rootScope', 'albums', '$state', 'playlists', 'auth', '$dialog', 'download-cached', '$window', '$timeout' + ($scope, $rootScope, albums, $state, playlists, auth, $dialog, cachedAlbum, $window, $timeout) -> album = null albums.fetch($state.params.id).done (albumResponse) -> $scope.album = albumResponse.album album = albumResponse.album + $rootScope.description = "Listen to #{album.title}, the album by #{album.user.name}, and more on the largest pony music site." $scope.playlists = [] diff --git a/resources/assets/scripts/app/controllers/playlist.coffee b/resources/assets/scripts/app/controllers/playlist.coffee index c2ab3e2b..c2b252c6 100644 --- a/resources/assets/scripts/app/controllers/playlist.coffee +++ b/resources/assets/scripts/app/controllers/playlist.coffee @@ -21,13 +21,14 @@ window.pfm.preloaders['playlist'] = [ ] angular.module('ponyfm').controller 'playlist', [ - '$scope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout' - ($scope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) -> + '$scope', '$rootScope', '$state', 'playlists', '$dialog', 'download-cached', '$window', '$timeout' + ($scope, $rootScope, $state, playlists, $dialog, cachedPlaylist, $window, $timeout) -> playlist = null playlists.fetch($state.params.id).done (playlistResponse) -> $scope.playlist = playlistResponse playlist = playlistResponse + #$rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site" $scope.share = () -> dialog = $dialog.dialog diff --git a/resources/assets/scripts/app/controllers/track.coffee b/resources/assets/scripts/app/controllers/track.coffee index b6112214..9393df1f 100644 --- a/resources/assets/scripts/app/controllers/track.coffee +++ b/resources/assets/scripts/app/controllers/track.coffee @@ -21,13 +21,14 @@ window.pfm.preloaders['track'] = [ ] angular.module('ponyfm').controller "track", [ - '$scope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout' - ($scope, tracks, $state, playlists, auth, favourites, $dialog, cachedTrack, $window, $timeout) -> + '$scope', '$rootScope', 'tracks', '$state', 'playlists', 'auth', 'favourites', '$dialog', 'download-cached', '$window', '$timeout' + ($scope, $rootScope, tracks, $state, playlists, auth, favourites, $dialog, cachedTrack, $window, $timeout) -> track = null tracks.fetch($state.params.id).done (trackResponse) -> $scope.track = trackResponse.track track = trackResponse.track + $rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site" $scope.playlists = [] diff --git a/resources/views/shared/_layout.blade.php b/resources/views/shared/_layout.blade.php index f69e5ef3..745fa951 100644 --- a/resources/views/shared/_layout.blade.php +++ b/resources/views/shared/_layout.blade.php @@ -15,18 +15,18 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --}}<!DOCTYPE html> -<html> +<html ng-app="ponyfm"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>Pony.fm</title> - <meta name="description" content="" /> + <meta name="description" content="@{{ description }}" /> <meta name="viewport" content="width=device-width" /> <base href="/" /> @yield('styles') </head> - <body ng-app="ponyfm" ng-controller="application" class="{{Auth::check() ? 'is-logged' : ''}}"> + <body ng-controller="application" class="{{Auth::check() ? 'is-logged' : ''}}"> @yield('content') @yield('scripts') </body> From 0375130ab637aea9998d74161c6951366d35b92a Mon Sep 17 00:00:00 2001 From: Adam Lavin <adam@lavoaster.co.uk> Date: Thu, 17 Dec 2015 00:25:42 +0000 Subject: [PATCH 2/9] Uncomented and properly implemented the playlist description #27 --- resources/assets/scripts/app/controllers/playlist.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/scripts/app/controllers/playlist.coffee b/resources/assets/scripts/app/controllers/playlist.coffee index c2b252c6..f522d8f5 100644 --- a/resources/assets/scripts/app/controllers/playlist.coffee +++ b/resources/assets/scripts/app/controllers/playlist.coffee @@ -28,7 +28,7 @@ angular.module('ponyfm').controller 'playlist', [ playlists.fetch($state.params.id).done (playlistResponse) -> $scope.playlist = playlistResponse playlist = playlistResponse - #$rootScope.description = "Listen to #{track.title} by #{track.user.name} on the largest pony music site" + $rootScope.description = "Listen to #{playlist.title} by #{playlist.user.name} on the largest pony music site" $scope.share = () -> dialog = $dialog.dialog From 851dfff9216b09d51f98e96bb07db248b640e8d3 Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Fri, 18 Dec 2015 00:56:13 -0800 Subject: [PATCH 3/9] #39: Implemented asynchronous encoding in uploads. --- app/Commands/CommandResponse.php | 32 ++++++-- app/Commands/UploadTrackCommand.php | 78 ++++++++++--------- app/Console/Commands/ImportMLPMA.php | 2 +- .../InvalidEncodeOptionsException.php | 25 ++++++ .../Controllers/Api/Web/TracksController.php | 29 ++++++- app/Http/Controllers/ApiControllerBase.php | 2 +- app/Http/routes.php | 1 + app/Jobs/EncodeTrackFile.php | 49 +++++++++--- app/Track.php | 45 +++++++++++ app/TrackFile.php | 7 ++ app/Traits/TrackCollection.php | 2 +- ...6_192855_update_track_files_with_cache.php | 3 +- ...nvert_track_file_in_progress_to_status.php | 51 ++++++++++++ public/templates/uploader/index.html | 8 +- .../assets/scripts/app/services/upload.coffee | 51 ++++++++++-- 15 files changed, 319 insertions(+), 66 deletions(-) create mode 100644 app/Exceptions/InvalidEncodeOptionsException.php create mode 100644 database/migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php diff --git a/app/Commands/CommandResponse.php b/app/Commands/CommandResponse.php index f0ab2729..ddb5e62f 100644 --- a/app/Commands/CommandResponse.php +++ b/app/Commands/CommandResponse.php @@ -24,11 +24,25 @@ use Illuminate\Validation\Validator; class CommandResponse { - public static function fail($validator) + /** + * @var Validator + */ + private $_validator; + private $_response; + private $_didFail; + + public static function fail($validatorOrMessages) { $response = new CommandResponse(); $response->_didFail = true; - $response->_validator = $validator; + + if (is_array($validatorOrMessages)) { + $response->_messages = $validatorOrMessages; + $response->_validator = null; + + } else { + $response->_validator = $validatorOrMessages; + } return $response; } @@ -42,10 +56,6 @@ class CommandResponse return $cmdResponse; } - private $_validator; - private $_response; - private $_didFail; - private function __construct() { } @@ -73,4 +83,14 @@ class CommandResponse { return $this->_validator; } + + public function getMessages() + { + if ($this->_validator !== null) { + return $this->_validator->messages()->getMessages(); + + } else { + return $this->_messages; + } + } } diff --git a/app/Commands/UploadTrackCommand.php b/app/Commands/UploadTrackCommand.php index 8f80a510..f801ff84 100644 --- a/app/Commands/UploadTrackCommand.php +++ b/app/Commands/UploadTrackCommand.php @@ -20,17 +20,22 @@ namespace Poniverse\Ponyfm\Commands; +use Config; +use Illuminate\Foundation\Bus\DispatchesJobs; +use Poniverse\Ponyfm\Exceptions\InvalidEncodeOptionsException; +use Poniverse\Ponyfm\Jobs\EncodeTrackFile; use Poniverse\Ponyfm\Track; use Poniverse\Ponyfm\TrackFile; use AudioCache; use File; -use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; -use Symfony\Component\Process\Exception\ProcessFailedException; -use Symfony\Component\Process\Process; +use Storage; class UploadTrackCommand extends CommandBase { + use DispatchesJobs; + + private $_allowLossy; private $_allowShortTrack; private $_losslessFormats = [ @@ -68,6 +73,21 @@ class UploadTrackCommand extends CommandBase $trackFile = \Input::file('track'); $audio = \AudioCache::get($trackFile->getPathname()); + + $track = new Track(); + $track->user_id = $user->id; + $track->title = pathinfo($trackFile->getClientOriginalName(), PATHINFO_FILENAME); + $track->duration = $audio->getDuration(); + $track->is_listed = true; + + $track->save(); + $track->ensureDirectoryExists(); + + Storage::makeDirectory(Config::get('ponyfm.files_directory') . '/queued-tracks', 0755, false, true); + $trackFile = $trackFile->move(Config::get('ponyfm.files_directory').'/queued-tracks', $track->id); + + + $validator = \Validator::make(['track' => $trackFile], [ 'track' => 'required|' @@ -77,24 +97,13 @@ class UploadTrackCommand extends CommandBase ]); if ($validator->fails()) { + $track->delete(); return CommandResponse::fail($validator); } - $track = new Track(); try { - $track->user_id = $user->id; - $track->title = pathinfo($trackFile->getClientOriginalName(), PATHINFO_FILENAME); - $track->duration = $audio->getDuration(); - $track->is_listed = true; - - $track->save(); - - $destination = $track->getDirectory(); - $track->ensureDirectoryExists(); - $source = $trackFile->getPathname(); - $index = 0; // Lossy uploads need to be identified and set as the master file // without being re-encoded. @@ -113,6 +122,7 @@ class UploadTrackCommand extends CommandBase } else { $validator->messages()->add('track', 'The track does not contain audio in a known lossy format.'); + $track->delete(); return CommandResponse::fail($validator); } @@ -126,6 +136,9 @@ class UploadTrackCommand extends CommandBase File::copy($source, $trackFile->getFile()); } + + $trackFiles = []; + foreach (Track::$Formats as $name => $format) { // Don't bother with lossless transcodes of lossy uploads, and // don't re-encode the lossy master. @@ -136,6 +149,7 @@ class UploadTrackCommand extends CommandBase $trackFile = new TrackFile(); $trackFile->is_master = $name === 'FLAC' ? true : false; $trackFile->format = $name; + $trackFile->status = TrackFile::STATUS_PROCESSING; if (in_array($name, Track::$CacheableFormats) && $trackFile->is_master == false) { $trackFile->is_cacheable = true; @@ -144,29 +158,21 @@ class UploadTrackCommand extends CommandBase } $track->trackFiles()->save($trackFile); - // Encode track file - $target = $trackFile->getFile(); - - $command = $format['command']; - $command = str_replace('{$source}', '"' . $source . '"', $command); - $command = str_replace('{$target}', '"' . $target . '"', $command); - - Log::info('Encoding ' . $track->id . ' into ' . $target); - $this->notify('Encoding ' . $name, $index / count(Track::$Formats) * 100); - - $process = new Process($command); - $process->mustRun(); - - // Update file size for track file - $trackFile->updateFilesize(); - - // Delete track file if it is cacheable - if ($trackFile->is_cacheable == true) { - File::delete($trackFile->getFile()); - } + // All TrackFile records we need are synchronously created + // before kicking off the encode jobs in order to avoid a race + // condition with the "temporary" source file getting deleted. + $trackFiles[] = $trackFile; } - $track->updateTags(); + try { + foreach($trackFiles as $trackFile) { + $this->dispatch(new EncodeTrackFile($trackFile, false, true)); + } + + } catch (InvalidEncodeOptionsException $e) { + $track->delete(); + return CommandResponse::fail(['track' => [$e->getMessage()]]); + } } catch (\Exception $e) { $track->delete(); diff --git a/app/Console/Commands/ImportMLPMA.php b/app/Console/Commands/ImportMLPMA.php index 52a03e89..d38cf454 100644 --- a/app/Console/Commands/ImportMLPMA.php +++ b/app/Console/Commands/ImportMLPMA.php @@ -365,7 +365,7 @@ class ImportMLPMA extends Command $result = $upload->execute(); if ($result->didFail()) { - $this->error(json_encode($result->getValidator()->messages()->getMessages(), JSON_PRETTY_PRINT)); + $this->error(json_encode($result->getMessages(), JSON_PRETTY_PRINT)); } else { // Save metadata. diff --git a/app/Exceptions/InvalidEncodeOptionsException.php b/app/Exceptions/InvalidEncodeOptionsException.php new file mode 100644 index 00000000..64181efe --- /dev/null +++ b/app/Exceptions/InvalidEncodeOptionsException.php @@ -0,0 +1,25 @@ +<?php + +/** + * Pony.fm - A community for pony fan music. + * Copyright (C) 2015 Peter Deltchev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace Poniverse\Ponyfm\Exceptions; + +use InvalidArgumentException; + +class InvalidEncodeOptionsException extends InvalidArgumentException {} diff --git a/app/Http/Controllers/Api/Web/TracksController.php b/app/Http/Controllers/Api/Web/TracksController.php index 81fefdce..b509fe80 100644 --- a/app/Http/Controllers/Api/Web/TracksController.php +++ b/app/Http/Controllers/Api/Web/TracksController.php @@ -33,6 +33,7 @@ use Cover; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Response; +use Poniverse\Ponyfm\TrackFile; class TracksController extends ApiControllerBase { @@ -40,7 +41,31 @@ class TracksController extends ApiControllerBase { session_write_close(); - return $this->execute(new UploadTrackCommand()); + try { + return $this->execute(new UploadTrackCommand()); + + } catch (\InvalidEncodeOptions $e) { + + } + } + + public function getUploadStatus($trackId) + { + // TODO: authorize this + + $track = Track::findOrFail($trackId); + + if ($track->status === Track::STATUS_PROCESSING){ + return Response::json(['message' => 'Processing...'], 202); + + } elseif ($track->status === Track::STATUS_COMPLETE) { + return Response::json(['message' => 'Processing complete!'], 201); + + } else { + // something went wrong + return Response::json(['error' => 'Processing failed!'], 500); + } + } public function postDelete($id) @@ -101,7 +126,7 @@ class TracksController extends ApiControllerBase // Return URL or begin encoding if ($trackFile->expires_at != null && File::exists($trackFile->getFile())) { $url = $track->getUrlFor($format); - } elseif ($trackFile->is_in_progress === true) { + } elseif ($trackFile->status === TrackFile::STATUS_PROCESSING) { $url = null; } else { $this->dispatch(new EncodeTrackFile($trackFile, true)); diff --git a/app/Http/Controllers/ApiControllerBase.php b/app/Http/Controllers/ApiControllerBase.php index c8420442..4f814fa6 100644 --- a/app/Http/Controllers/ApiControllerBase.php +++ b/app/Http/Controllers/ApiControllerBase.php @@ -35,7 +35,7 @@ abstract class ApiControllerBase extends Controller if ($result->didFail()) { return Response::json([ 'message' => 'Validation failed', - 'errors' => $result->getValidator()->messages()->getMessages() + 'errors' => $result->getMessages() ], 400); } diff --git a/app/Http/routes.php b/app/Http/routes.php index 48f53bd2..afa12b27 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -101,6 +101,7 @@ Route::group(['prefix' => 'api/web'], function() { Route::group(['middleware' => 'auth'], function() { Route::post('/tracks/upload', 'Api\Web\TracksController@postUpload'); + Route::get('/tracks/{id}/upload-status', 'Api\Web\TracksController@getUploadStatus'); Route::post('/tracks/delete/{id}', 'Api\Web\TracksController@postDelete'); Route::post('/tracks/edit/{id}', 'Api\Web\TracksController@postEdit'); diff --git a/app/Jobs/EncodeTrackFile.php b/app/Jobs/EncodeTrackFile.php index 2b135556..fc53c34a 100644 --- a/app/Jobs/EncodeTrackFile.php +++ b/app/Jobs/EncodeTrackFile.php @@ -2,6 +2,7 @@ /** * Pony.fm - A community for pony fan music. + * Copyright (C) 2015 Peter Deltchev * Copyright (C) 2015 Kelvin Zhang * * This program is free software: you can redistribute it and/or modify @@ -21,9 +22,11 @@ namespace Poniverse\Ponyfm\Jobs; use Carbon\Carbon; +use File; use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Log; use OAuth2\Exception; +use Poniverse\Ponyfm\Exceptions\InvalidEncodeOptionsException; use Poniverse\Ponyfm\Jobs\Job; use Illuminate\Queue\SerializesModels; use Illuminate\Queue\InteractsWithQueue; @@ -45,16 +48,29 @@ class EncodeTrackFile extends Job implements SelfHandling, ShouldQueue * @var */ private $isExpirable; + /** + * @var bool + */ + private $isForUpload; /** * Create a new job instance. * @param TrackFile $trackFile - * @param $isExpirable + * @param bool $isExpirable + * @param bool $isForUpload indicates whether this encode job is for an upload */ - public function __construct(TrackFile $trackFile, $isExpirable) + public function __construct(TrackFile $trackFile, $isExpirable, $isForUpload = false) { + if( + (!$isForUpload && $trackFile->is_master) || + ($isForUpload && $trackFile->is_master && !$trackFile->getFormat()['is_lossless']) + ) { + throw new InvalidEncodeOptionsException("Master files cannot be encoded unless we're generating a lossless master file during the upload process."); + } + $this->trackFile = $trackFile; $this->isExpirable = $isExpirable; + $this->isForUpload = $isForUpload; } /** @@ -65,14 +81,19 @@ class EncodeTrackFile extends Job implements SelfHandling, ShouldQueue public function handle() { // Start the job - $this->trackFile->is_in_progress = true; + $this->trackFile->status = TrackFile::STATUS_PROCESSING; $this->trackFile->update(); // Use the track's master file as the source - $source = TrackFile::where('track_id', $this->trackFile->track_id) - ->where('is_master', true) - ->first() - ->getFile(); + if ($this->isForUpload) { + $source = $this->trackFile->track->getTemporarySourceFile(); + + } else { + $source = TrackFile::where('track_id', $this->trackFile->track_id) + ->where('is_master', true) + ->first() + ->getFile(); + } // Assign the target $this->trackFile->track->ensureDirectoryExists(); @@ -111,8 +132,18 @@ class EncodeTrackFile extends Job implements SelfHandling, ShouldQueue $this->trackFile->updateFilesize(); // Complete the job - $this->trackFile->is_in_progress = false; + $this->trackFile->status = TrackFile::STATUS_NOT_BEING_PROCESSED; $this->trackFile->update(); + + if ($this->isForUpload) { + if (!$this->trackFile->is_master && $this->trackFile->is_cacheable) { + File::delete($this->trackFile->getFile()); + } + + if ($this->trackFile->track->status === Track::STATUS_COMPLETE) { + File::delete($this->trackFile->track->getTemporarySourceFile()); + } + } } /** @@ -122,7 +153,7 @@ class EncodeTrackFile extends Job implements SelfHandling, ShouldQueue */ public function failed() { - $this->trackFile->is_in_progress = false; + $this->trackFile->status = TrackFile::STATUS_PROCESSING_ERROR; $this->trackFile->expires_at = null; $this->trackFile->update(); } diff --git a/app/Track.php b/app/Track.php index 57e43298..a9afdd3d 100644 --- a/app/Track.php +++ b/app/Track.php @@ -48,6 +48,12 @@ class Track extends Model use RevisionableTrait; + // Used for the track's upload status. + const STATUS_COMPLETE = 0; + const STATUS_PROCESSING = 1; + const STATUS_ERROR = 2; + + public static $Formats = [ 'FLAC' => [ 'index' => 0, @@ -579,6 +585,18 @@ class Track extends Model return "{$this->getDirectory()}/{$this->id}.{$format['extension']}"; } + /** + * Returns the path to the "temporary" master file uploaded by the user. + * This file is used during the upload process to generate the actual master + * file stored by Pony.fm. + * + * @return string + */ + public function getTemporarySourceFile() { + return Config::get('ponyfm.files_directory') . '/queued-tracks/' . $this->id; + } + + public function getUrlFor($format) { if (!isset(self::$Formats[$format])) { @@ -590,6 +608,33 @@ class Track extends Model return URL::to('/t' . $this->id . '/dl.' . $format['extension']); } + + /** + * @return string one of the Track::STATUS_* values, indicating whether this track is currently being processed + */ + public function getStatusAttribute(){ + return $this->trackFiles->reduce(function($carry, $trackFile){ + if($trackFile->status === TrackFile::STATUS_PROCESSING_ERROR) { + return static::STATUS_ERROR; + + } elseif ( + $carry !== static::STATUS_ERROR && + $trackFile->status === TrackFile::STATUS_PROCESSING) { + return static::STATUS_PROCESSING; + + } elseif ( + !in_array($carry, [static::STATUS_ERROR, static::STATUS_PROCESSING]) && + $trackFile->status === TrackFile::STATUS_NOT_BEING_PROCESSED + ) { + return static::STATUS_COMPLETE; + + } else { + return $carry; + } + }, static::STATUS_COMPLETE); + } + + public function updateHash() { $this->hash = md5(Helpers::sanitizeInputForHashing($this->user->display_name) . ' - ' . Helpers::sanitizeInputForHashing($this->title)); diff --git a/app/TrackFile.php b/app/TrackFile.php index 63556f4e..22e9d779 100644 --- a/app/TrackFile.php +++ b/app/TrackFile.php @@ -20,6 +20,7 @@ namespace Poniverse\Ponyfm; +use Config; use Helpers; use Illuminate\Database\Eloquent\Model; use App; @@ -28,6 +29,12 @@ use URL; class TrackFile extends Model { + // used for the "status" property + const STATUS_NOT_BEING_PROCESSED = 0; + const STATUS_PROCESSING = 1; + const STATUS_PROCESSING_ERROR = 2; + + public function track() { return $this->belongsTo('Poniverse\Ponyfm\Track')->withTrashed(); diff --git a/app/Traits/TrackCollection.php b/app/Traits/TrackCollection.php index 2be06db0..ec8f15c9 100644 --- a/app/Traits/TrackCollection.php +++ b/app/Traits/TrackCollection.php @@ -103,7 +103,7 @@ trait TrackCollection foreach ($trackFiles as $trackFile) { /** @var TrackFile $trackFile */ - if (!File::exists($trackFile->getFile()) && $trackFile->is_in_progress != true) { + if (!File::exists($trackFile->getFile()) && $trackFile->status == TrackFile::STATUS_NOT_BEING_PROCESSED) { $this->dispatch(new EncodeTrackFile($trackFile, true)); } } diff --git a/database/migrations/2015_10_26_192855_update_track_files_with_cache.php b/database/migrations/2015_10_26_192855_update_track_files_with_cache.php index 5352f319..8b27c22f 100644 --- a/database/migrations/2015_10_26_192855_update_track_files_with_cache.php +++ b/database/migrations/2015_10_26_192855_update_track_files_with_cache.php @@ -2,6 +2,7 @@ /** * Pony.fm - A community for pony fan music. + * Copyright (C) 2015 Peter Deltchev * Copyright (C) 2015 Kelvin Zhang * * This program is free software: you can redistribute it and/or modify @@ -32,7 +33,7 @@ class UpdateTrackFilesWithCache extends Migration { Schema::table('track_files', function (Blueprint $table) { $table->boolean('is_cacheable')->default(false)->index(); - $table->boolean('is_in_progress')->default(false); + $table->tinyInteger('is_in_progress')->default(false); $table->dateTime('expires_at')->nullable()->index(); }); } diff --git a/database/migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php b/database/migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php new file mode 100644 index 00000000..ff116691 --- /dev/null +++ b/database/migrations/2015_12_18_025953_convert_track_file_in_progress_to_status.php @@ -0,0 +1,51 @@ +<?php + +/** + * Pony.fm - A community for pony fan music. + * Copyright (C) 2015 Peter Deltchev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class ConvertTrackFileInProgressToStatus extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + // + Schema::table('track_files', function(Blueprint $table) { + $table->renameColumn('is_in_progress', 'status'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + // + Schema::table('track_files', function (Blueprint $table) { + $table->renameColumn('status', 'is_in_progress'); + }); + } +} diff --git a/public/templates/uploader/index.html b/public/templates/uploader/index.html index 6139d8bd..31acaec6 100644 --- a/public/templates/uploader/index.html +++ b/public/templates/uploader/index.html @@ -10,15 +10,17 @@ <p>Please note that you need to publish your tracks after uploading them before they will become available to the public.</p> <ul class="uploads"> - <li ng-repeat="upload in data.queue" ng-class="{'uploading': upload.isUploading, 'has-error': upload.error != null, 'is-processing': upload.isUploading && upload.error == null && upload.progress >= 100}" ng-animate="'upload-queue'"> + <li ng-repeat="upload in data.queue" ng-class="{'uploading': upload.isUploading, 'has-error': upload.error != null, 'is-processing': upload.isProcessing || upload.progress >= 100}" ng-animate="'upload-queue'"> <p> + <span ng-show="!upload.success"> - <strong ng-show="upload.isUploading && upload.error == null && upload.progress >= 100">Processing</strong> - <strong ng-show="upload.isUploading && upload.error == null && upload.progress < 100">Uploading</strong> + <strong ng-show="upload.isUploading && upload.error == null && upload.progress < 100">Uploading…</strong> + <strong ng-show="upload.isProcessing || (upload.isUploading && upload.progress >= 100)">Processing…</strong> <strong ng-show="upload.error != null">Error</strong> {{upload.name}} - <strong ng-show="upload.error != null">{{upload.error}}</strong> </span> + <span ng-show="upload.success"> <a href="/account/tracks/edit/{{upload.trackId}}" class="btn btn-small btn-primary"> Publish diff --git a/resources/assets/scripts/app/services/upload.coffee b/resources/assets/scripts/app/services/upload.coffee index 4205ff1b..06a13852 100644 --- a/resources/assets/scripts/app/services/upload.coffee +++ b/resources/assets/scripts/app/services/upload.coffee @@ -15,11 +15,39 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. angular.module('ponyfm').factory('upload', [ - '$rootScope' - ($rootScope) -> + '$rootScope', '$http', '$timeout' + ($rootScope, $http, $timeout) -> self = queue: [] + finishUploadWrapper: (upload)-> + ()-> + self.finishUpload(upload) + + # Polls for the upload's status + finishUpload: (upload) -> + # TODO: update upload status + $http.get("/api/web/tracks/#{upload.trackId}/upload-status").then( + # handle success or still-processing + (response)-> + if response.status == 202 + $timeout(self.finishUploadWrapper(upload), 5000) + + else if response.status == 201 + upload.isProcessing = false + upload.success = true + + # handle error + ,(response)-> + upload.isProcessing = false + if response.headers['content-type'] == 'application/json' + upload.error = response.data.error + else + upload.error = 'There was an unknown error!' + ) + + + upload: (files) -> _.each files, (file) -> upload = @@ -29,6 +57,8 @@ angular.module('ponyfm').factory('upload', [ size: file.size index: self.queue.length isUploading: true + isProcessing: false + trackId: null success: false error: null @@ -42,22 +72,31 @@ angular.module('ponyfm').factory('upload', [ upload.progress = e.loaded / upload.size * 100 $rootScope.$broadcast 'upload-progress', upload + # TODO: Implement polling here + # event listener xhr.onload = -> $rootScope.$apply -> upload.isUploading = false - if xhr.status != 200 + upload.isProcessing = true + + if xhr.status == 200 + # kick off polling + upload.trackId = $.parseJSON(xhr.responseText).id + self.finishUpload(upload) + + else error = if xhr.getResponseHeader('content-type') == 'application/json' $.parseJSON(xhr.responseText).errors.track.join ', ' else 'There was an unknown error!' + upload.isProcessing = false upload.error = error $rootScope.$broadcast 'upload-error', [upload, error] - else - upload.success = true - upload.trackId = $.parseJSON(xhr.responseText).id $rootScope.$broadcast 'upload-finished', upload + + # send the track to the server formData = new FormData(); formData.append('track', file); From c99ec8fc54a4e9e35a3020c0ec9f9210de347449 Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Fri, 18 Dec 2015 05:33:30 -0800 Subject: [PATCH 4/9] #39: Fixed a typing issue with database results. --- app/Track.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Track.php b/app/Track.php index a9afdd3d..2882db92 100644 --- a/app/Track.php +++ b/app/Track.php @@ -614,17 +614,17 @@ class Track extends Model */ public function getStatusAttribute(){ return $this->trackFiles->reduce(function($carry, $trackFile){ - if($trackFile->status === TrackFile::STATUS_PROCESSING_ERROR) { + if((int) $trackFile->status === TrackFile::STATUS_PROCESSING_ERROR) { return static::STATUS_ERROR; } elseif ( $carry !== static::STATUS_ERROR && - $trackFile->status === TrackFile::STATUS_PROCESSING) { + (int) $trackFile->status === TrackFile::STATUS_PROCESSING) { return static::STATUS_PROCESSING; } elseif ( !in_array($carry, [static::STATUS_ERROR, static::STATUS_PROCESSING]) && - $trackFile->status === TrackFile::STATUS_NOT_BEING_PROCESSED + (int) $trackFile->status === TrackFile::STATUS_NOT_BEING_PROCESSED ) { return static::STATUS_COMPLETE; From 476e6b480059f7ed217c790c102f5c53c4824d80 Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Sun, 20 Dec 2015 03:20:04 -0800 Subject: [PATCH 5/9] Updated getID3() to the latest version. --- app/Library/getid3/.gitattributes | 0 app/Library/getid3/.gitignore | 7 +- app/Library/getid3/README.md | 2 +- app/Library/getid3/changelog.txt | 11 + app/Library/getid3/composer.json | 0 .../getid3/demos/demo.audioinfo.class.php | 0 app/Library/getid3/demos/demo.basic.php | 0 app/Library/getid3/demos/demo.browse.php | 10 +- app/Library/getid3/demos/demo.cache.dbm.php | 0 app/Library/getid3/demos/demo.cache.mysql.php | 1 + app/Library/getid3/demos/demo.joinmp3.php | 72 ++- app/Library/getid3/demos/demo.mimeonly.php | 0 app/Library/getid3/demos/demo.mp3header.php | 29 +- app/Library/getid3/demos/demo.mysql.php | 0 app/Library/getid3/demos/demo.simple.php | 0 .../getid3/demos/demo.simple.write.php | 0 app/Library/getid3/demos/demo.write.php | 0 app/Library/getid3/demos/demo.zip.php | 0 app/Library/getid3/demos/getid3.css | 0 .../getid3/demos/getid3.demo.dirscan.php | 0 app/Library/getid3/demos/index.php | 0 app/Library/getid3/dependencies.txt | 0 .../getid3/getid3/extension.cache.dbm.php | 0 .../getid3/getid3/extension.cache.mysql.php | 8 +- .../getid3/getid3/extension.cache.sqlite3.php | 55 +- app/Library/getid3/getid3/getid3.lib.php | 47 +- app/Library/getid3/getid3/getid3.php | 39 +- .../getid3/getid3/module.archive.gzip.php | 0 .../getid3/getid3/module.archive.rar.php | 0 .../getid3/getid3/module.archive.szip.php | 0 .../getid3/getid3/module.archive.tar.php | 0 .../getid3/getid3/module.archive.zip.php | 0 .../getid3/getid3/module.audio-video.asf.php | 0 .../getid3/getid3/module.audio-video.bink.php | 0 .../getid3/getid3/module.audio-video.flv.php | 2 +- .../getid3/module.audio-video.matroska.php | 33 + .../getid3/getid3/module.audio-video.mpeg.php | 0 .../getid3/getid3/module.audio-video.nsv.php | 0 .../getid3/module.audio-video.quicktime.php | 563 ++++++++++++------ .../getid3/getid3/module.audio-video.real.php | 0 .../getid3/getid3/module.audio-video.riff.php | 0 .../getid3/getid3/module.audio-video.swf.php | 0 .../getid3/getid3/module.audio-video.ts.php | 0 app/Library/getid3/getid3/module.audio.aa.php | 0 .../getid3/getid3/module.audio.aac.php | 0 .../getid3/getid3/module.audio.ac3.php | 0 .../getid3/getid3/module.audio.amr.php | 0 app/Library/getid3/getid3/module.audio.au.php | 0 .../getid3/getid3/module.audio.avr.php | 0 .../getid3/getid3/module.audio.bonk.php | 0 .../getid3/getid3/module.audio.dss.php | 0 .../getid3/getid3/module.audio.dts.php | 0 .../getid3/getid3/module.audio.flac.php | 0 app/Library/getid3/getid3/module.audio.la.php | 0 .../getid3/getid3/module.audio.lpac.php | 0 .../getid3/getid3/module.audio.midi.php | 0 .../getid3/getid3/module.audio.mod.php | 0 .../getid3/getid3/module.audio.monkey.php | 0 .../getid3/getid3/module.audio.mp3.php | 18 +- .../getid3/getid3/module.audio.mpc.php | 0 .../getid3/getid3/module.audio.ogg.php | 1 + .../getid3/getid3/module.audio.optimfrog.php | 0 .../getid3/getid3/module.audio.rkau.php | 0 .../getid3/getid3/module.audio.shorten.php | 0 .../getid3/getid3/module.audio.tta.php | 0 .../getid3/getid3/module.audio.voc.php | 0 .../getid3/getid3/module.audio.vqf.php | 0 .../getid3/getid3/module.audio.wavpack.php | 0 .../getid3/getid3/module.graphic.bmp.php | 0 .../getid3/getid3/module.graphic.efax.php | 0 .../getid3/getid3/module.graphic.gif.php | 0 .../getid3/getid3/module.graphic.jpg.php | 0 .../getid3/getid3/module.graphic.pcd.php | 0 .../getid3/getid3/module.graphic.png.php | 32 +- .../getid3/getid3/module.graphic.svg.php | 0 .../getid3/getid3/module.graphic.tiff.php | 0 app/Library/getid3/getid3/module.misc.cue.php | 0 app/Library/getid3/getid3/module.misc.exe.php | 0 app/Library/getid3/getid3/module.misc.iso.php | 0 .../getid3/getid3/module.misc.msoffice.php | 0 .../getid3/getid3/module.misc.par2.php | 0 app/Library/getid3/getid3/module.misc.pdf.php | 0 .../getid3/getid3/module.tag.apetag.php | 14 +- .../getid3/getid3/module.tag.id3v1.php | 0 .../getid3/getid3/module.tag.id3v2.php | 63 +- .../getid3/getid3/module.tag.lyrics3.php | 0 app/Library/getid3/getid3/module.tag.xmp.php | 0 app/Library/getid3/getid3/write.apetag.php | 0 app/Library/getid3/getid3/write.id3v1.php | 0 app/Library/getid3/getid3/write.id3v2.php | 13 +- app/Library/getid3/getid3/write.lyrics3.php | 0 app/Library/getid3/getid3/write.metaflac.php | 0 app/Library/getid3/getid3/write.php | 2 +- app/Library/getid3/getid3/write.real.php | 0 .../getid3/getid3/write.vorbiscomment.php | 0 app/Library/getid3/helperapps/head.exe | Bin app/Library/getid3/helperapps/md5sum.exe | Bin app/Library/getid3/helperapps/metaflac.exe | Bin .../getid3/helperapps/readme.helperapps.txt | 0 app/Library/getid3/helperapps/shorten.exe | Bin app/Library/getid3/helperapps/tail.exe | Bin .../getid3/helperapps/vorbiscomment.exe | Bin app/Library/getid3/license.txt | 0 .../getid3/licenses/licence.gpl-10.txt | 0 .../getid3/licenses/licence.gpl-20.txt | 0 .../getid3/licenses/licence.gpl-30.txt | 0 .../getid3/licenses/licence.lgpl-30.txt | 0 .../getid3/licenses/licence.mpl-20.txt | 0 .../getid3/licenses/license.commercial.txt | 0 app/Library/getid3/readme.txt | 13 +- app/Library/getid3/structure.txt | 0 111 files changed, 730 insertions(+), 305 deletions(-) mode change 100755 => 100644 app/Library/getid3/.gitattributes mode change 100755 => 100644 app/Library/getid3/.gitignore mode change 100755 => 100644 app/Library/getid3/README.md mode change 100755 => 100644 app/Library/getid3/changelog.txt mode change 100755 => 100644 app/Library/getid3/composer.json mode change 100755 => 100644 app/Library/getid3/demos/demo.audioinfo.class.php mode change 100755 => 100644 app/Library/getid3/demos/demo.basic.php mode change 100755 => 100644 app/Library/getid3/demos/demo.browse.php mode change 100755 => 100644 app/Library/getid3/demos/demo.cache.dbm.php mode change 100755 => 100644 app/Library/getid3/demos/demo.cache.mysql.php mode change 100755 => 100644 app/Library/getid3/demos/demo.joinmp3.php mode change 100755 => 100644 app/Library/getid3/demos/demo.mimeonly.php mode change 100755 => 100644 app/Library/getid3/demos/demo.mp3header.php mode change 100755 => 100644 app/Library/getid3/demos/demo.mysql.php mode change 100755 => 100644 app/Library/getid3/demos/demo.simple.php mode change 100755 => 100644 app/Library/getid3/demos/demo.simple.write.php mode change 100755 => 100644 app/Library/getid3/demos/demo.write.php mode change 100755 => 100644 app/Library/getid3/demos/demo.zip.php mode change 100755 => 100644 app/Library/getid3/demos/getid3.css mode change 100755 => 100644 app/Library/getid3/demos/getid3.demo.dirscan.php mode change 100755 => 100644 app/Library/getid3/demos/index.php mode change 100755 => 100644 app/Library/getid3/dependencies.txt mode change 100755 => 100644 app/Library/getid3/getid3/extension.cache.dbm.php mode change 100755 => 100644 app/Library/getid3/getid3/extension.cache.mysql.php mode change 100755 => 100644 app/Library/getid3/getid3/extension.cache.sqlite3.php mode change 100755 => 100644 app/Library/getid3/getid3/getid3.lib.php mode change 100755 => 100644 app/Library/getid3/getid3/getid3.php mode change 100755 => 100644 app/Library/getid3/getid3/module.archive.gzip.php mode change 100755 => 100644 app/Library/getid3/getid3/module.archive.rar.php mode change 100755 => 100644 app/Library/getid3/getid3/module.archive.szip.php mode change 100755 => 100644 app/Library/getid3/getid3/module.archive.tar.php mode change 100755 => 100644 app/Library/getid3/getid3/module.archive.zip.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.asf.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.bink.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.flv.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.matroska.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.mpeg.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.nsv.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.quicktime.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.real.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.riff.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.swf.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio-video.ts.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.aa.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.aac.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.ac3.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.amr.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.au.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.avr.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.bonk.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.dss.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.dts.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.flac.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.la.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.lpac.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.midi.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.mod.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.monkey.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.mp3.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.mpc.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.ogg.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.optimfrog.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.rkau.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.shorten.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.tta.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.voc.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.vqf.php mode change 100755 => 100644 app/Library/getid3/getid3/module.audio.wavpack.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.bmp.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.efax.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.gif.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.jpg.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.pcd.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.png.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.svg.php mode change 100755 => 100644 app/Library/getid3/getid3/module.graphic.tiff.php mode change 100755 => 100644 app/Library/getid3/getid3/module.misc.cue.php mode change 100755 => 100644 app/Library/getid3/getid3/module.misc.exe.php mode change 100755 => 100644 app/Library/getid3/getid3/module.misc.iso.php mode change 100755 => 100644 app/Library/getid3/getid3/module.misc.msoffice.php mode change 100755 => 100644 app/Library/getid3/getid3/module.misc.par2.php mode change 100755 => 100644 app/Library/getid3/getid3/module.misc.pdf.php mode change 100755 => 100644 app/Library/getid3/getid3/module.tag.apetag.php mode change 100755 => 100644 app/Library/getid3/getid3/module.tag.id3v1.php mode change 100755 => 100644 app/Library/getid3/getid3/module.tag.id3v2.php mode change 100755 => 100644 app/Library/getid3/getid3/module.tag.lyrics3.php mode change 100755 => 100644 app/Library/getid3/getid3/module.tag.xmp.php mode change 100755 => 100644 app/Library/getid3/getid3/write.apetag.php mode change 100755 => 100644 app/Library/getid3/getid3/write.id3v1.php mode change 100755 => 100644 app/Library/getid3/getid3/write.id3v2.php mode change 100755 => 100644 app/Library/getid3/getid3/write.lyrics3.php mode change 100755 => 100644 app/Library/getid3/getid3/write.metaflac.php mode change 100755 => 100644 app/Library/getid3/getid3/write.php mode change 100755 => 100644 app/Library/getid3/getid3/write.real.php mode change 100755 => 100644 app/Library/getid3/getid3/write.vorbiscomment.php mode change 100755 => 100644 app/Library/getid3/helperapps/head.exe mode change 100755 => 100644 app/Library/getid3/helperapps/md5sum.exe mode change 100755 => 100644 app/Library/getid3/helperapps/metaflac.exe mode change 100755 => 100644 app/Library/getid3/helperapps/readme.helperapps.txt mode change 100755 => 100644 app/Library/getid3/helperapps/shorten.exe mode change 100755 => 100644 app/Library/getid3/helperapps/tail.exe mode change 100755 => 100644 app/Library/getid3/helperapps/vorbiscomment.exe mode change 100755 => 100644 app/Library/getid3/license.txt mode change 100755 => 100644 app/Library/getid3/licenses/licence.gpl-10.txt mode change 100755 => 100644 app/Library/getid3/licenses/licence.gpl-20.txt mode change 100755 => 100644 app/Library/getid3/licenses/licence.gpl-30.txt mode change 100755 => 100644 app/Library/getid3/licenses/licence.lgpl-30.txt mode change 100755 => 100644 app/Library/getid3/licenses/licence.mpl-20.txt mode change 100755 => 100644 app/Library/getid3/licenses/license.commercial.txt mode change 100755 => 100644 app/Library/getid3/readme.txt mode change 100755 => 100644 app/Library/getid3/structure.txt diff --git a/app/Library/getid3/.gitattributes b/app/Library/getid3/.gitattributes old mode 100755 new mode 100644 diff --git a/app/Library/getid3/.gitignore b/app/Library/getid3/.gitignore old mode 100755 new mode 100644 index ecc47c4f..d4575fce --- a/app/Library/getid3/.gitignore +++ b/app/Library/getid3/.gitignore @@ -1,4 +1,4 @@ -helperapps/sha1sum.exe +helperapps/*.exe helperapps/*.dll @@ -110,7 +110,9 @@ ClientBin stylecop.* ~$* *.dbmdl -Generated_Code #added for RIA/Silverlight projects + +#added for RIA/Silverlight projects +Generated_Code # Backup & report files from converting an old project file to a newer # Visual Studio version. Backup files are not needed, because we have git ;-) @@ -165,3 +167,4 @@ pip-log.txt # Mac crap .DS_Store +demos/php_error.log diff --git a/app/Library/getid3/README.md b/app/Library/getid3/README.md old mode 100755 new mode 100644 index c7e7522a..da7e7923 --- a/app/Library/getid3/README.md +++ b/app/Library/getid3/README.md @@ -186,7 +186,7 @@ if ($fp_remote = fopen($remotefilename, 'rb')) { fclose($fp_local); // Initialize getID3 engine $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze($filename); + $ThisFileInfo = $getID3->analyze($localtempfilename); // Delete temporary file unlink($localtempfilename); } diff --git a/app/Library/getid3/changelog.txt b/app/Library/getid3/changelog.txt old mode 100755 new mode 100644 index 1bd712dd..2c0cca62 --- a/app/Library/getid3/changelog.txt +++ b/app/Library/getid3/changelog.txt @@ -18,6 +18,17 @@ Version History =============== +1.9.10: [2015-09-14] James Heinrich + * bugfix (G:49): Declaration of getID3_cached_sqlite3 + * bugfix (#1892): extension.cache.mysql + * bugfix (#1891): duplicate default clause [Quicktime] + * bugfix (G:41): incorrect MP3 playtime + * bugfix: iconv problems on musl with //TRANSLIT + * Add arguments to analyze() for original filesize (and filename) + * ID3v2 simplify handling of multiple genres + * Corrected merging of multiple genres for ID3v2 + * getid3_lib::GetDataImageSize return false on error + 1.9.9: [2014-12-18] James Heinrich » Added basic support for OggOpus » Add ID3v2 CHAP + CTOC support diff --git a/app/Library/getid3/composer.json b/app/Library/getid3/composer.json old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.audioinfo.class.php b/app/Library/getid3/demos/demo.audioinfo.class.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.basic.php b/app/Library/getid3/demos/demo.basic.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.browse.php b/app/Library/getid3/demos/demo.browse.php old mode 100755 new mode 100644 index 65be568a..cde883aa --- a/app/Library/getid3/demos/demo.browse.php +++ b/app/Library/getid3/demos/demo.browse.php @@ -480,8 +480,11 @@ function table_var_dump($variable, $wrap_in_td=false, $encoding='ISO-8859-1') { //if (($key == 'data') && isset($variable['image_mime']) && isset($variable['dataoffset'])) { if (($key == 'data') && isset($variable['image_mime'])) { $imageinfo = array(); - $imagechunkcheck = getid3_lib::GetDataImageSize($value, $imageinfo); - $returnstring .= '</td>'."\n".'<td><img src="data:'.$variable['image_mime'].';base64,'.base64_encode($value).'" width="'.$imagechunkcheck[0].'" height="'.$imagechunkcheck[1].'"></td></tr>'."\n"; + if ($imagechunkcheck = getid3_lib::GetDataImageSize($value, $imageinfo)) { + $returnstring .= '</td>'."\n".'<td><img src="data:'.$variable['image_mime'].';base64,'.base64_encode($value).'" width="'.$imagechunkcheck[0].'" height="'.$imagechunkcheck[1].'"></td></tr>'."\n"; + } else { + $returnstring .= '</td>'."\n".'<td><i>invalid image data</i></td></tr>'."\n"; + } } else { $returnstring .= '</td>'."\n".table_var_dump($value, true, $encoding).'</tr>'."\n"; } @@ -515,8 +518,7 @@ function table_var_dump($variable, $wrap_in_td=false, $encoding='ISO-8859-1') { default: $imageinfo = array(); - $imagechunkcheck = getid3_lib::GetDataImageSize($variable, $imageinfo); - if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { + if (($imagechunkcheck = getid3_lib::GetDataImageSize($variable, $imageinfo)) && ($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { $returnstring .= ($wrap_in_td ? '<td>' : ''); $returnstring .= '<table class="dump" cellspacing="0" cellpadding="2">'; $returnstring .= '<tr><td><b>type</b></td><td>'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]).'</td></tr>'."\n"; diff --git a/app/Library/getid3/demos/demo.cache.dbm.php b/app/Library/getid3/demos/demo.cache.dbm.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.cache.mysql.php b/app/Library/getid3/demos/demo.cache.mysql.php old mode 100755 new mode 100644 index 037a7e27..e2ca9c9e --- a/app/Library/getid3/demos/demo.cache.mysql.php +++ b/app/Library/getid3/demos/demo.cache.mysql.php @@ -17,6 +17,7 @@ die('Due to a security issue, this demo has been disabled. It can be enabled by require_once('../getid3/getid3.php'); +require_once('../getid3/getid3.lib.php'); getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'extension.cache.mysql.php', __FILE__, true); $getID3 = new getID3_cached_mysql('localhost', 'database', 'username', 'password'); diff --git a/app/Library/getid3/demos/demo.joinmp3.php b/app/Library/getid3/demos/demo.joinmp3.php old mode 100755 new mode 100644 index 215af94f..b819e930 --- a/app/Library/getid3/demos/demo.joinmp3.php +++ b/app/Library/getid3/demos/demo.joinmp3.php @@ -9,37 +9,47 @@ // /demo/demo.joinmp3.php - part of getID3() // // Sample script for splicing two or more MP3s together into // // one file. Does not attempt to fix VBR header frames. // +// Can also be used to extract portion from single file. // // See readme.txt for more details // // /// ///////////////////////////////////////////////////////////////// // sample usage: -// $FilenameOut = 'combined.mp3'; -// $FilenamesIn[] = 'file1.mp3'; -// $FilenamesIn[] = 'file2.mp3'; -// $FilenamesIn[] = 'file3.mp3'; +// $FilenameOut = 'combined.mp3'; +// $FilenamesIn[] = 'first.mp3'; // filename with no start/length parameters +// $FilenamesIn[] = array('second.mp3', 0, 0); // filename with zero for start/length is the same as not specified (start = beginning, length = full duration) +// $FilenamesIn[] = array('third.mp3', 0, 10); // extract first 10 seconds of audio +// $FilenamesIn[] = array('fourth.mp3', -10, 0); // extract last 10 seconds of audio +// $FilenamesIn[] = array('fifth.mp3', 10, 0); // extract everything except first 10 seconds of audio +// $FilenamesIn[] = array('sixth.mp3', 0, -10); // extract everything except last 10 seconds of audio +// if (CombineMultipleMP3sTo($FilenameOut, $FilenamesIn)) { +// echo 'Successfully copied '.implode(' + ', $FilenamesIn).' to '.$FilenameOut; +// } else { +// echo 'Failed to copy '.implode(' + ', $FilenamesIn).' to '.$FilenameOut; +// } // -// if (CombineMultipleMP3sTo($FilenameOut, $FilenamesIn)) { -// echo 'Successfully copied '.implode(' + ', $FilenamesIn).' to '.$FilenameOut; -// } else { -// echo 'Failed to copy '.implode(' + ', $FilenamesIn).' to '.$FilenameOut; -// } +// Could also be called like this to extract portion from single file: +// CombineMultipleMP3sTo('sample.mp3', array(array('input.mp3', 0, 30))); // extract first 30 seconds of audio + function CombineMultipleMP3sTo($FilenameOut, $FilenamesIn) { foreach ($FilenamesIn as $nextinputfilename) { + if (is_array($nextinputfilename)) { + $nextinputfilename = $nextinputfilename[0]; + } if (!is_readable($nextinputfilename)) { echo 'Cannot read "'.$nextinputfilename.'"<BR>'; return false; } } - if (!is_writeable($FilenameOut)) { + if ((file_exists($FilenameOut) && !is_writeable($FilenameOut)) || (!file_exists($FilenameOut) && !is_writeable(dirname($FilenameOut)))) { echo 'Cannot write "'.$FilenameOut.'"<BR>'; return false; } - require_once('../getid3/getid3.php'); + require_once(dirname(__FILE__).'/../getid3/getid3.php'); ob_start(); if ($fp_output = fopen($FilenameOut, 'wb')) { @@ -47,7 +57,11 @@ function CombineMultipleMP3sTo($FilenameOut, $FilenamesIn) { // Initialize getID3 engine $getID3 = new getID3; foreach ($FilenamesIn as $nextinputfilename) { - + $startoffset = 0; + $length_seconds = 0; + if (is_array($nextinputfilename)) { + @list($nextinputfilename, $startoffset, $length_seconds) = $nextinputfilename; + } $CurrentFileInfo = $getID3->analyze($nextinputfilename); if ($CurrentFileInfo['fileformat'] == 'mp3') { @@ -58,17 +72,35 @@ function CombineMultipleMP3sTo($FilenameOut, $FilenamesIn) { $CurrentOutputPosition = ftell($fp_output); // copy audio data from first file - fseek($fp_source, $CurrentFileInfo['avdataoffset'], SEEK_SET); - while (!feof($fp_source) && (ftell($fp_source) < $CurrentFileInfo['avdataend'])) { - fwrite($fp_output, fread($fp_source, 32768)); + $start_offset_bytes = $CurrentFileInfo['avdataoffset']; + if ($startoffset > 0) { // start X seconds from start of audio + $start_offset_bytes = $CurrentFileInfo['avdataoffset'] + round($CurrentFileInfo['bitrate'] / 8 * $startoffset); + } elseif ($startoffset < 0) { // start X seconds from end of audio + $start_offset_bytes = $CurrentFileInfo['avdataend'] + round($CurrentFileInfo['bitrate'] / 8 * $startoffset); + } + $start_offset_bytes = max($CurrentFileInfo['avdataoffset'], min($CurrentFileInfo['avdataend'], $start_offset_bytes)); + + $end_offset_bytes = $CurrentFileInfo['avdataend']; + if ($length_seconds > 0) { // seconds from start of audio + $end_offset_bytes = $start_offset_bytes + round($CurrentFileInfo['bitrate'] / 8 * $length_seconds); + } elseif ($length_seconds < 0) { // seconds from start of audio + $end_offset_bytes = $CurrentFileInfo['avdataend'] + round($CurrentFileInfo['bitrate'] / 8 * $startoffset); + } + $end_offset_bytes = max($CurrentFileInfo['avdataoffset'], min($CurrentFileInfo['avdataend'], $end_offset_bytes)); + + if ($end_offset_bytes <= $start_offset_bytes) { + echo 'failed to copy '.$nextinputfilename.' from '.$startoffset.'-seconds start for '.$length_seconds.'-seconds length (not enough data)'; + fclose($fp_source); + fclose($fp_output); + return false; + } + + fseek($fp_source, $start_offset_bytes, SEEK_SET); + while (!feof($fp_source) && (ftell($fp_source) < $end_offset_bytes)) { + fwrite($fp_output, fread($fp_source, min(32768, $end_offset_bytes - ftell($fp_source)))); } fclose($fp_source); - // trim post-audio data (if any) copied from first file that we don't need or want - $EndOfFileOffset = $CurrentOutputPosition + ($CurrentFileInfo['avdataend'] - $CurrentFileInfo['avdataoffset']); - fseek($fp_output, $EndOfFileOffset, SEEK_SET); - ftruncate($fp_output, $EndOfFileOffset); - } else { $errormessage = ob_get_contents(); diff --git a/app/Library/getid3/demos/demo.mimeonly.php b/app/Library/getid3/demos/demo.mimeonly.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.mp3header.php b/app/Library/getid3/demos/demo.mp3header.php old mode 100755 new mode 100644 index 846db679..ad5a3d8a --- a/app/Library/getid3/demos/demo.mp3header.php +++ b/app/Library/getid3/demos/demo.mp3header.php @@ -29,10 +29,10 @@ if (!function_exists('table_var_dump')) { $returnstring = ''; switch (gettype($variable)) { case 'array': - $returnstring .= '<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="2">'; + $returnstring .= '<table border="1" cellspacing="0" cellpadding="2">'; foreach ($variable as $key => $value) { - $returnstring .= '<TR><TD VALIGN="TOP"><B>'.str_replace(chr(0), ' ', $key).'</B></TD>'; - $returnstring .= '<TD VALIGN="TOP">'.gettype($value); + $returnstring .= '<tr><td valign="top"><b>'.str_replace(chr(0), ' ', $key).'</b></td>'; + $returnstring .= '<td valign="top">'.gettype($value); if (is_array($value)) { $returnstring .= ' ('.count($value).')'; } elseif (is_string($value)) { @@ -41,18 +41,21 @@ if (!function_exists('table_var_dump')) { if (($key == 'data') && isset($variable['image_mime']) && isset($variable['dataoffset'])) { require_once(GETID3_INCLUDEPATH.'getid3.getimagesize.php'); $imageinfo = array(); - $imagechunkcheck = GetDataImageSize($value, $imageinfo); - $DumpedImageSRC = (!empty($_REQUEST['filename']) ? $_REQUEST['filename'] : '.getid3').'.'.$variable['dataoffset'].'.'.ImageTypesLookup($imagechunkcheck[2]); - if ($tempimagefile = fopen($DumpedImageSRC, 'wb')) { - fwrite($tempimagefile, $value); - fclose($tempimagefile); + if ($imagechunkcheck = GetDataImageSize($value, $imageinfo)) { + $DumpedImageSRC = (!empty($_REQUEST['filename']) ? $_REQUEST['filename'] : '.getid3').'.'.$variable['dataoffset'].'.'.ImageTypesLookup($imagechunkcheck[2]); + if ($tempimagefile = fopen($DumpedImageSRC, 'wb')) { + fwrite($tempimagefile, $value); + fclose($tempimagefile); + } + $returnstring .= '</td><td><img src="'.$DumpedImageSRC.'" width="'.$imagechunkcheck[0].'" height="'.$imagechunkcheck[1].'"></td></tr>'; + } else { + $returnstring .= '</td><td><i>invalid image data</i></td></tr>'; } - $returnstring .= '</TD><TD><IMG SRC="'.$DumpedImageSRC.'" WIDTH="'.$imagechunkcheck[0].'" HEIGHT="'.$imagechunkcheck[1].'"></TD></TR>'; } else { - $returnstring .= '</TD><TD>'.table_var_dump($value).'</TD></TR>'; + $returnstring .= '</td><td>'.table_var_dump($value).'</td></tr>'; } } - $returnstring .= '</TABLE>'; + $returnstring .= '</table>'; break; case 'boolean': @@ -86,9 +89,7 @@ if (!function_exists('table_var_dump')) { default: require_once(GETID3_INCLUDEPATH.'getid3.getimagesize.php'); $imageinfo = array(); - $imagechunkcheck = GetDataImageSize(substr($variable, 0, 32768), $imageinfo); - - if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { + if (($imagechunkcheck = GetDataImageSize(substr($variable, 0, 32768), $imageinfo)) && ($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { $returnstring .= '<table border="1" cellspacing="0" cellpadding="2">'; $returnstring .= '<tr><td><b>type</b></td><td>'.ImageTypesLookup($imagechunkcheck[2]).'</td></tr>'; $returnstring .= '<tr><td><b>width</b></td><td>'.number_format($imagechunkcheck[0]).' px</td></tr>'; diff --git a/app/Library/getid3/demos/demo.mysql.php b/app/Library/getid3/demos/demo.mysql.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.simple.php b/app/Library/getid3/demos/demo.simple.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.simple.write.php b/app/Library/getid3/demos/demo.simple.write.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.write.php b/app/Library/getid3/demos/demo.write.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/demo.zip.php b/app/Library/getid3/demos/demo.zip.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/getid3.css b/app/Library/getid3/demos/getid3.css old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/getid3.demo.dirscan.php b/app/Library/getid3/demos/getid3.demo.dirscan.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/demos/index.php b/app/Library/getid3/demos/index.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/dependencies.txt b/app/Library/getid3/dependencies.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/extension.cache.dbm.php b/app/Library/getid3/getid3/extension.cache.dbm.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/extension.cache.mysql.php b/app/Library/getid3/getid3/extension.cache.mysql.php old mode 100755 new mode 100644 index 2647584f..a94eb9d9 --- a/app/Library/getid3/getid3/extension.cache.mysql.php +++ b/app/Library/getid3/getid3/extension.cache.mysql.php @@ -134,7 +134,7 @@ class getID3_cached_mysql extends getID3 // public: analyze file - public function analyze($filename) { + public function analyze($filename, $filesize=null, $original_filename='') { if (file_exists($filename)) { @@ -157,7 +157,7 @@ class getID3_cached_mysql extends getID3 } // Miss - $analysis = parent::analyze($filename); + $analysis = parent::analyze($filename, $filesize, $original_filename); // Save result if (file_exists($filename)) { @@ -178,11 +178,11 @@ class getID3_cached_mysql extends getID3 private function create_table($drop=false) { $SQLquery = 'CREATE TABLE IF NOT EXISTS `'.mysql_real_escape_string($this->table).'` ('; - $SQLquery .= '`filename` VARCHAR(255) NOT NULL DEFAULT \'\''; + $SQLquery .= '`filename` VARCHAR(500) NOT NULL DEFAULT \'\''; $SQLquery .= ', `filesize` INT(11) NOT NULL DEFAULT \'0\''; $SQLquery .= ', `filetime` INT(11) NOT NULL DEFAULT \'0\''; $SQLquery .= ', `analyzetime` INT(11) NOT NULL DEFAULT \'0\''; - $SQLquery .= ', `value` TEXT NOT NULL'; + $SQLquery .= ', `value` LONGTEXT NOT NULL'; $SQLquery .= ', PRIMARY KEY (`filename`, `filesize`, `filetime`)) ENGINE=MyISAM'; $this->cursor = mysql_query($SQLquery, $this->connection); echo mysql_error($this->connection); diff --git a/app/Library/getid3/getid3/extension.cache.sqlite3.php b/app/Library/getid3/getid3/extension.cache.sqlite3.php old mode 100755 new mode 100644 index dd232390..58d4dc88 --- a/app/Library/getid3/getid3/extension.cache.sqlite3.php +++ b/app/Library/getid3/getid3/extension.cache.sqlite3.php @@ -49,20 +49,20 @@ * * sqlite3 table='getid3_cache', hide=false (PHP5) * - -*** database file will be stored in the same directory as this script, -*** webserver must have write access to that directory! -*** set $hide to TRUE to prefix db file with .ht to pervent access from web client -*** this is a default setting in the Apache configuration: - -# The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients. - -<Files ~ "^\.ht"> - Order allow,deny - Deny from all - Satisfy all -</Files> - +* +* *** database file will be stored in the same directory as this script, +* *** webserver must have write access to that directory! +* *** set $hide to TRUE to prefix db file with .ht to pervent access from web client +* *** this is a default setting in the Apache configuration: +* +* The following lines prevent .htaccess and .htpasswd files from being viewed by Web clients. +* +* <Files ~ "^\.ht"> +* Order allow,deny +* Deny from all +* Satisfy all +* </Files> +* ******************************************************************************** * * ------------------------------------------------------------------- @@ -159,13 +159,13 @@ class getID3_cached_sqlite3 extends getID3 { * @param type $filename * @return boolean */ - public function analyze($filename) { + public function analyze($filename, $filesize=null, $original_filename='') { if (!file_exists($filename)) { return false; } // items to track for caching $filetime = filemtime($filename); - $filesize = filesize($filename); + $filesize_real = filesize($filename); // this will be saved for a quick directory lookup of analized files // ... why do 50 seperate sql quries when you can do 1 for the same result $dirname = dirname($filename); @@ -173,25 +173,25 @@ class getID3_cached_sqlite3 extends getID3 { $db = $this->db; $sql = $this->get_id3_data; $stmt = $db->prepare($sql); - $stmt->bindValue(':filename', $filename, SQLITE3_TEXT); - $stmt->bindValue(':filesize', $filesize, SQLITE3_INTEGER); - $stmt->bindValue(':filetime', $filetime, SQLITE3_INTEGER); + $stmt->bindValue(':filename', $filename, SQLITE3_TEXT); + $stmt->bindValue(':filesize', $filesize_real, SQLITE3_INTEGER); + $stmt->bindValue(':filetime', $filetime, SQLITE3_INTEGER); $res = $stmt->execute(); list($result) = $res->fetchArray(); if (count($result) > 0 ) { return unserialize(base64_decode($result)); } // if it hasn't been analyzed before, then do it now - $analysis = parent::analyze($filename); + $analysis = parent::analyze($filename, $filesize, $original_filename); // Save result $sql = $this->cache_file; $stmt = $db->prepare($sql); - $stmt->bindValue(':filename', $filename, SQLITE3_TEXT); - $stmt->bindValue(':dirname', $dirname, SQLITE3_TEXT); - $stmt->bindValue(':filesize', $filesize, SQLITE3_INTEGER); - $stmt->bindValue(':filetime', $filetime, SQLITE3_INTEGER); - $stmt->bindValue(':atime', time(), SQLITE3_INTEGER); - $stmt->bindValue(':val', base64_encode(serialize($analysis)), SQLITE3_TEXT); + $stmt->bindValue(':filename', $filename, SQLITE3_TEXT); + $stmt->bindValue(':dirname', $dirname, SQLITE3_TEXT); + $stmt->bindValue(':filesize', $filesize_real, SQLITE3_INTEGER); + $stmt->bindValue(':filetime', $filetime, SQLITE3_INTEGER); + $stmt->bindValue(':atime', time(), SQLITE3_INTEGER); + $stmt->bindValue(':val', base64_encode(serialize($analysis)), SQLITE3_TEXT); $res = $stmt->execute(); return $analysis; } @@ -253,7 +253,8 @@ class getID3_cached_sqlite3 extends getID3 { return "INSERT INTO $this->table (filename, dirname, filesize, filetime, analyzetime, val) VALUES (:filename, :dirname, :filesize, :filetime, :atime, :val)"; break; case 'make_table': - return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) NOT NULL DEFAULT '', dirname VARCHAR(255) NOT NULL DEFAULT '', filesize INT(11) NOT NULL DEFAULT '0', filetime INT(11) NOT NULL DEFAULT '0', analyzetime INT(11) NOT NULL DEFAULT '0', val text not null, PRIMARY KEY (filename, filesize, filetime))"; + //return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) NOT NULL DEFAULT '', dirname VARCHAR(255) NOT NULL DEFAULT '', filesize INT(11) NOT NULL DEFAULT '0', filetime INT(11) NOT NULL DEFAULT '0', analyzetime INT(11) NOT NULL DEFAULT '0', val text not null, PRIMARY KEY (filename, filesize, filetime))"; + return "CREATE TABLE IF NOT EXISTS $this->table (filename VARCHAR(255) DEFAULT '', dirname VARCHAR(255) DEFAULT '', filesize INT(11) DEFAULT '0', filetime INT(11) DEFAULT '0', analyzetime INT(11) DEFAULT '0', val text, PRIMARY KEY (filename, filesize, filetime))"; break; case 'get_cached_dir': return "SELECT val FROM $this->table WHERE dirname = :dirname"; diff --git a/app/Library/getid3/getid3/getid3.lib.php b/app/Library/getid3/getid3/getid3.lib.php old mode 100755 new mode 100644 index efb3ba5e..1dc97a62 --- a/app/Library/getid3/getid3/getid3.lib.php +++ b/app/Library/getid3/getid3/getid3.lib.php @@ -414,6 +414,20 @@ class getid3_lib return $newarray; } + public static function flipped_array_merge_noclobber($array1, $array2) { + if (!is_array($array1) || !is_array($array2)) { + return false; + } + # naturally, this only works non-recursively + $newarray = array_flip($array1); + foreach (array_flip($array2) as $key => $val) { + if (!isset($newarray[$key])) { + $newarray[$key] = count($newarray); + } + } + return array_flip($newarray); + } + public static function ksort_recursive(&$theArray) { ksort($theArray); @@ -522,12 +536,12 @@ class getid3_lib if (function_exists('simplexml_load_string') && function_exists('libxml_disable_entity_loader')) { // http://websec.io/2012/08/27/Preventing-XEE-in-PHP.html // https://core.trac.wordpress.org/changeset/29378 - $loader = libxml_disable_entity_loader(true); - $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT); - $return = self::SimpleXMLelement2array($XMLobject); - libxml_disable_entity_loader($loader); - return $return; - } + $loader = libxml_disable_entity_loader(true); + $XMLobject = simplexml_load_string($XMLstring, 'SimpleXMLElement', LIBXML_NOENT); + $return = self::SimpleXMLelement2array($XMLobject); + libxml_disable_entity_loader($loader); + return $return; + } return false; } @@ -606,7 +620,7 @@ class getid3_lib if (empty($tempdir)) { // yes this is ugly, feel free to suggest a better way - require_once(dirname(__FILE__) . '/getid3.php'); + require_once(dirname(__FILE__).'/getid3.php'); $getid3_temp = new getID3(); $tempdir = $getid3_temp->tempdir; unset($getid3_temp); @@ -1153,11 +1167,19 @@ class getid3_lib public static function GetDataImageSize($imgData, &$imageinfo=array()) { static $tempdir = ''; if (empty($tempdir)) { + if (function_exists('sys_get_temp_dir')) { + $tempdir = sys_get_temp_dir(); // https://github.com/JamesHeinrich/getID3/issues/52 + } + // yes this is ugly, feel free to suggest a better way - require_once(dirname(__FILE__) . '/getid3.php'); - $getid3_temp = new getID3(); - $tempdir = $getid3_temp->tempdir; - unset($getid3_temp); + if (include_once(dirname(__FILE__).'/getid3.php')) { + if ($getid3_temp = new getID3()) { + if ($getid3_temp_tempdir = $getid3_temp->tempdir) { + $tempdir = $getid3_temp_tempdir; + } + unset($getid3_temp, $getid3_temp_tempdir); + } + } } $GetDataImageSize = false; if ($tempfilename = tempnam($tempdir, 'gI3')) { @@ -1165,6 +1187,9 @@ class getid3_lib fwrite($tmp, $imgData); fclose($tmp); $GetDataImageSize = @getimagesize($tempfilename, $imageinfo); + if (($GetDataImageSize === false) || !isset($GetDataImageSize[0]) || !isset($GetDataImageSize[1])) { + return false; + } $GetDataImageSize['height'] = $GetDataImageSize[0]; $GetDataImageSize['width'] = $GetDataImageSize[1]; } diff --git a/app/Library/getid3/getid3/getid3.php b/app/Library/getid3/getid3/getid3.php old mode 100755 new mode 100644 index 25a52fdd..b7b54d35 --- a/app/Library/getid3/getid3/getid3.php +++ b/app/Library/getid3/getid3/getid3.php @@ -109,7 +109,7 @@ class getID3 protected $startup_error = ''; protected $startup_warning = ''; - const VERSION = '1.9.9-20141121'; + const VERSION = '1.9.10-201511241457'; const FREAD_BUFFER_SIZE = 32768; const ATTACHMENTS_NONE = false; @@ -166,7 +166,7 @@ class getID3 } // Load support library - if (!include_once(GETID3_INCLUDEPATH . 'getid3.lib.php')) { + if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { $this->startup_error .= 'getid3.lib.php is missing or corrupt'; } @@ -243,7 +243,7 @@ class getID3 } - public function openfile($filename) { + public function openfile($filename, $filesize=null) { try { if (!empty($this->startup_error)) { throw new getid3_exception($this->startup_error); @@ -287,7 +287,7 @@ class getID3 throw new getid3_exception('Could not open "'.$filename.'" ('.implode('; ', $errormessagelist).')'); } - $this->info['filesize'] = filesize($filename); + $this->info['filesize'] = (!is_null($filesize) ? $filesize : filesize($filename)); // set redundant parameters - might be needed in some include file // filenames / filepaths in getID3 are always expressed with forward slashes (unix-style) for both Windows and other to try and minimize confusion $filename = str_replace('\\', '/', $filename); @@ -342,9 +342,9 @@ class getID3 } // public: analyze file - public function analyze($filename) { + public function analyze($filename, $filesize=null, $original_filename='') { try { - if (!$this->openfile($filename)) { + if (!$this->openfile($filename, $filesize)) { return $this->info; } @@ -389,7 +389,7 @@ class getID3 $formattest = fread($this->fp, 32774); // determine format - $determined_format = $this->GetFileFormat($formattest, $filename); + $determined_format = $this->GetFileFormat($formattest, ($original_filename ? $original_filename : $filename)); // unable to determine file format if (!$determined_format) { @@ -876,7 +876,7 @@ class getID3 'pattern' => '^(RIFF|SDSS|FORM)', 'group' => 'audio-video', 'module' => 'riff', - 'mime_type' => 'audio/x-wave', + 'mime_type' => 'audio/x-wav', 'fail_ape' => 'WARNING', ), @@ -1235,6 +1235,29 @@ class getID3 } } + // ID3v1 encoding detection hack start + // ID3v1 is defined as always using ISO-8859-1 encoding, but it is not uncommon to find files tagged with ID3v1 using Windows-1251 or other character sets + // Since ID3v1 has no concept of character sets there is no certain way to know we have the correct non-ISO-8859-1 character set, but we can guess + if ($comment_name == 'id3v1') { + if ($encoding == 'ISO-8859-1') { + if (function_exists('iconv')) { + foreach ($this->info['tags'][$tag_name] as $tag_key => $valuearray) { + foreach ($valuearray as $key => $value) { + if (preg_match('#^[\\x80-\\xFF]+$#', $value)) { + foreach (array('windows-1251', 'KOI8-R') as $id3v1_bad_encoding) { + if (@iconv($id3v1_bad_encoding, $id3v1_bad_encoding, $value) === $value) { + $encoding = $id3v1_bad_encoding; + break 3; + } + } + } + } + } + } + } + } + // ID3v1 encoding detection hack end + $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted! } diff --git a/app/Library/getid3/getid3/module.archive.gzip.php b/app/Library/getid3/getid3/module.archive.gzip.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.archive.rar.php b/app/Library/getid3/getid3/module.archive.rar.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.archive.szip.php b/app/Library/getid3/getid3/module.archive.szip.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.archive.tar.php b/app/Library/getid3/getid3/module.archive.tar.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.archive.zip.php b/app/Library/getid3/getid3/module.archive.zip.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.asf.php b/app/Library/getid3/getid3/module.audio-video.asf.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.bink.php b/app/Library/getid3/getid3/module.audio-video.bink.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.flv.php b/app/Library/getid3/getid3/module.audio-video.flv.php old mode 100755 new mode 100644 index c5fbd4b0..2f86ebd9 --- a/app/Library/getid3/getid3/module.audio-video.flv.php +++ b/app/Library/getid3/getid3/module.audio-video.flv.php @@ -541,7 +541,7 @@ class AMFReader { // Long string default: $value = '(unknown or unsupported data type)'; - break; + break; } return $value; diff --git a/app/Library/getid3/getid3/module.audio-video.matroska.php b/app/Library/getid3/getid3/module.audio-video.matroska.php old mode 100755 new mode 100644 index f2cc5ac0..09793602 --- a/app/Library/getid3/getid3/module.audio-video.matroska.php +++ b/app/Library/getid3/getid3/module.audio-video.matroska.php @@ -457,6 +457,7 @@ class getid3_matroska extends getid3_handler default: $this->warning('Unhandled audio type "'.(isset($trackarray['CodecID']) ? $trackarray['CodecID'] : '').'"'); + break; } $info['audio']['streams'][] = $track_info; @@ -524,6 +525,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('header', __LINE__, $element_data); + break; } unset($element_data['offset'], $element_data['end']); @@ -562,6 +564,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } + break; } if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required @@ -571,6 +574,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('seekhead', __LINE__, $seek_entry); + break; } } break; @@ -653,6 +657,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('track.video', __LINE__, $sub_subelement); + break; } } break; @@ -678,6 +683,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('track.audio', __LINE__, $sub_subelement); + break; } } break; @@ -713,6 +719,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement); + break; } } break; @@ -736,24 +743,28 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('track.contentencodings.contentencoding.contentcompression', __LINE__, $sub_sub_sub_subelement); + break; } } break; default: $this->unhandledElement('track.contentencodings.contentencoding', __LINE__, $sub_sub_subelement); + break; } } break; default: $this->unhandledElement('track.contentencodings', __LINE__, $sub_subelement); + break; } } break; default: $this->unhandledElement('track', __LINE__, $subelement); + break; } } @@ -762,6 +773,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('tracks', __LINE__, $track_entry); + break; } } break; @@ -825,6 +837,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('info.chaptertranslate', __LINE__, $sub_subelement); + break; } } $info_entry[$subelement['id_name']] = $chaptertranslate_entry; @@ -832,6 +845,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('info', __LINE__, $subelement); + break; } } $info['matroska']['info'][] = $info_entry; @@ -868,6 +882,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('cues.cuepoint.cuetrackpositions', __LINE__, $sub_sub_subelement); + break; } } $cuepoint_entry[$sub_subelement['id_name']][] = $cuetrackpositions_entry; @@ -879,6 +894,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('cues.cuepoint', __LINE__, $sub_subelement); + break; } } $cues_entry[] = $cuepoint_entry; @@ -886,6 +902,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('cues', __LINE__, $subelement); + break; } } $info['matroska']['cues'] = $cues_entry; @@ -927,6 +944,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('tags.tag.targets', __LINE__, $sub_sub_subelement); + break; } } $tag_entry[$sub_subelement['id_name']] = $targets_entry; @@ -938,6 +956,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('tags.tag', __LINE__, $sub_subelement); + break; } } $tags_entry[] = $tag_entry; @@ -945,6 +964,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('tags', __LINE__, $subelement); + break; } } $info['matroska']['tags'] = $tags_entry; @@ -985,6 +1005,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('attachments.attachedfile', __LINE__, $sub_subelement); + break; } } $info['matroska']['attachments'][] = $attachedfile_entry; @@ -992,6 +1013,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('attachments', __LINE__, $subelement); + break; } } break; @@ -1051,6 +1073,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('chapters.editionentry.chapteratom.chaptertrack', __LINE__, $sub_sub_sub_subelement); + break; } } $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chaptertrack_entry; @@ -1070,6 +1093,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('chapters.editionentry.chapteratom.chapterdisplay', __LINE__, $sub_sub_sub_subelement); + break; } } $chapteratom_entry[$sub_sub_subelement['id_name']][] = $chapterdisplay_entry; @@ -1077,6 +1101,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('chapters.editionentry.chapteratom', __LINE__, $sub_sub_subelement); + break; } } $editionentry_entry[$sub_subelement['id_name']][] = $chapteratom_entry; @@ -1084,6 +1109,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('chapters.editionentry', __LINE__, $sub_subelement); + break; } } $info['matroska']['chapters'][] = $editionentry_entry; @@ -1091,6 +1117,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('chapters', __LINE__, $subelement); + break; } } break; @@ -1119,6 +1146,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('cluster.silenttracks', __LINE__, $sub_subelement); + break; } } $cluster_entry[$subelement['id_name']][] = $cluster_silent_tracks; @@ -1149,6 +1177,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('clusters.blockgroup', __LINE__, $sub_subelement); + break; } } $cluster_entry[$subelement['id_name']][] = $cluster_block_group; @@ -1160,6 +1189,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('cluster', __LINE__, $subelement); + break; } $this->current_offset = $subelement['end']; } @@ -1181,12 +1211,14 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('segment', __LINE__, $element_data); + break; } } break; default: $this->unhandledElement('root', __LINE__, $top_element); + break; } } } @@ -1339,6 +1371,7 @@ class getid3_matroska extends getid3_handler default: $this->unhandledElement('tag.simpletag', __LINE__, $element); + break; } } diff --git a/app/Library/getid3/getid3/module.audio-video.mpeg.php b/app/Library/getid3/getid3/module.audio-video.mpeg.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.nsv.php b/app/Library/getid3/getid3/module.audio-video.nsv.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.quicktime.php b/app/Library/getid3/getid3/module.audio-video.quicktime.php old mode 100755 new mode 100644 index 482c0912..73853d09 --- a/app/Library/getid3/getid3/module.audio-video.quicktime.php +++ b/app/Library/getid3/getid3/module.audio-video.quicktime.php @@ -81,6 +81,81 @@ class getid3_quicktime extends getid3_handler unset($info['avdataend_tmp']); } + if (!empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) { + $durations = $this->quicktime_time_to_sample_table($info); + for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) { + $bookmark = array(); + $bookmark['title'] = $info['quicktime']['comments']['chapters'][$i]; + if (isset($durations[$i])) { + $bookmark['duration_sample'] = $durations[$i]['sample_duration']; + if ($i > 0) { + $bookmark['start_sample'] = $info['quicktime']['bookmarks'][($i - 1)]['start_sample'] + $info['quicktime']['bookmarks'][($i - 1)]['duration_sample']; + } else { + $bookmark['start_sample'] = 0; + } + if ($time_scale = $this->quicktime_bookmark_time_scale($info)) { + $bookmark['duration_seconds'] = $bookmark['duration_sample'] / $time_scale; + $bookmark['start_seconds'] = $bookmark['start_sample'] / $time_scale; + } + } + $info['quicktime']['bookmarks'][] = $bookmark; + } + } + + if (isset($info['quicktime']['temp_meta_key_names'])) { + unset($info['quicktime']['temp_meta_key_names']); + } + + if (!empty($info['quicktime']['comments']['location.ISO6709'])) { + // https://en.wikipedia.org/wiki/ISO_6709 + foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) { + $latitude = false; + $longitude = false; + $altitude = false; + if (preg_match('#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string, $matches)) { + @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches; + + if (strlen($lat_deg) == 2) { // [+-]DD.D + $latitude = floatval(ltrim($lat_deg, '0').$lat_deg_dec); + } elseif (strlen($lat_deg) == 4) { // [+-]DDMM.M + $latitude = floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60); + } elseif (strlen($lat_deg) == 6) { // [+-]DDMMSS.S + $latitude = floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2), '0').$lat_deg_dec / 3600); + } + + if (strlen($lon_deg) == 3) { // [+-]DDD.D + $longitude = floatval(ltrim($lon_deg, '0').$lon_deg_dec); + } elseif (strlen($lon_deg) == 5) { // [+-]DDDMM.M + $longitude = floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60); + } elseif (strlen($lon_deg) == 7) { // [+-]DDDMMSS.S + $longitude = floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2), '0').$lon_deg_dec / 3600); + } + + if (strlen($alt_deg) == 3) { // [+-]DDD.D + $altitude = floatval(ltrim($alt_deg, '0').$alt_deg_dec); + } elseif (strlen($alt_deg) == 5) { // [+-]DDDMM.M + $altitude = floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60); + } elseif (strlen($alt_deg) == 7) { // [+-]DDDMMSS.S + $altitude = floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2), '0').$alt_deg_dec / 3600); + } + + if ($latitude !== false) { + $info['quicktime']['comments']['gps_latitude'][] = (($lat_sign == '-') ? -1 : 1) * floatval($latitude); + } + if ($longitude !== false) { + $info['quicktime']['comments']['gps_longitude'][] = (($lon_sign == '-') ? -1 : 1) * floatval($longitude); + } + if ($altitude !== false) { + $info['quicktime']['comments']['gps_altitude'][] = (($alt_sign == '-') ? -1 : 1) * floatval($altitude); + } + } + if ($latitude === false) { + $info['warning'][] = 'location.ISO6709 string not parsed correctly: "'.$ISO6709string.'", please submit as a bug'; + } + break; + } + } + if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) { $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; } @@ -120,6 +195,7 @@ class getid3_quicktime extends getid3_handler public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm + // https://code.google.com/p/mp4v2/wiki/iTunesMetadata $info = &$this->getid3->info; @@ -222,81 +298,88 @@ class getid3_quicktime extends getid3_handler break; + case "\xA9".'alb': // ALBum + case "\xA9".'ART': // + case "\xA9".'art': // ARTist + case "\xA9".'aut': // + case "\xA9".'cmt': // CoMmenT + case "\xA9".'com': // COMposer + case "\xA9".'cpy': // + case "\xA9".'day': // content created year + case "\xA9".'dir': // + case "\xA9".'ed1': // + case "\xA9".'ed2': // + case "\xA9".'ed3': // + case "\xA9".'ed4': // + case "\xA9".'ed5': // + case "\xA9".'ed6': // + case "\xA9".'ed7': // + case "\xA9".'ed8': // + case "\xA9".'ed9': // + case "\xA9".'enc': // + case "\xA9".'fmt': // + case "\xA9".'gen': // GENre + case "\xA9".'grp': // GRouPing + case "\xA9".'hst': // + case "\xA9".'inf': // + case "\xA9".'lyr': // LYRics + case "\xA9".'mak': // + case "\xA9".'mod': // + case "\xA9".'nam': // full NAMe + case "\xA9".'ope': // + case "\xA9".'PRD': // + case "\xA9".'prf': // + case "\xA9".'req': // + case "\xA9".'src': // + case "\xA9".'swr': // + case "\xA9".'too': // encoder + case "\xA9".'trk': // TRacK + case "\xA9".'url': // + case "\xA9".'wrn': // + case "\xA9".'wrt': // WRiTer + case '----': // itunes specific case 'aART': // Album ARTist + case 'akID': // iTunes store account type + case 'apID': // Purchase Account + case 'atID': // case 'catg': // CaTeGory + case 'cmID': // + case 'cnID': // case 'covr': // COVeR artwork case 'cpil': // ComPILation case 'cprt': // CoPyRighT case 'desc': // DESCription case 'disk': // DISK number case 'egid': // Episode Global ID + case 'geID': // case 'gnre': // GeNRE + case 'hdvd': // HD ViDeo case 'keyw': // KEYWord - case 'ldes': + case 'ldes': // Long DEScription case 'pcst': // PodCaST case 'pgap': // GAPless Playback + case 'plID': // case 'purd': // PURchase Date case 'purl': // Podcast URL - case 'rati': - case 'rndu': - case 'rpdu': + case 'rati': // + case 'rndu': // + case 'rpdu': // case 'rtng': // RaTiNG - case 'stik': + case 'sfID': // iTunes store country + case 'soaa': // SOrt Album Artist + case 'soal': // SOrt ALbum + case 'soar': // SOrt ARtist + case 'soco': // SOrt COmposer + case 'sonm': // SOrt NaMe + case 'sosn': // SOrt Show Name + case 'stik': // case 'tmpo': // TeMPO (BPM) case 'trkn': // TRacK Number + case 'tven': // tvEpisodeID case 'tves': // TV EpiSode case 'tvnn': // TV Network Name case 'tvsh': // TV SHow Name case 'tvsn': // TV SeasoN - case 'akID': // iTunes store account type - case 'apID': - case 'atID': - case 'cmID': - case 'cnID': - case 'geID': - case 'plID': - case 'sfID': // iTunes store country - case "\xA9".'alb': // ALBum - case "\xA9".'art': // ARTist - case "\xA9".'ART': - case "\xA9".'aut': - case "\xA9".'cmt': // CoMmenT - case "\xA9".'com': // COMposer - case "\xA9".'cpy': - case "\xA9".'day': // content created year - case "\xA9".'dir': - case "\xA9".'ed1': - case "\xA9".'ed2': - case "\xA9".'ed3': - case "\xA9".'ed4': - case "\xA9".'ed5': - case "\xA9".'ed6': - case "\xA9".'ed7': - case "\xA9".'ed8': - case "\xA9".'ed9': - case "\xA9".'enc': - case "\xA9".'fmt': - case "\xA9".'gen': // GENre - case "\xA9".'grp': // GRouPing - case "\xA9".'hst': - case "\xA9".'inf': - case "\xA9".'lyr': // LYRics - case "\xA9".'mak': - case "\xA9".'mod': - case "\xA9".'nam': // full NAMe - case "\xA9".'ope': - case "\xA9".'PRD': - case "\xA9".'prd': - case "\xA9".'prf': - case "\xA9".'req': - case "\xA9".'src': - case "\xA9".'swr': - case "\xA9".'too': // encoder - case "\xA9".'trk': // TRacK - case "\xA9".'url': - case "\xA9".'wrn': - case "\xA9".'wrt': // WRiTer - case '----': // itunes specific if ($atom_parent == 'udta') { // User data atom handler $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); @@ -361,17 +444,21 @@ class getid3_quicktime extends getid3_handler case 21: // tmpo/cpil flag switch ($atomname) { case 'cpil': + case 'hdvd': case 'pcst': case 'pgap': + // 8-bit integer (boolean) $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); break; case 'tmpo': + // 16-bit integer $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 2)); break; case 'disk': case 'trkn': + // binary $num = getid3_lib::BigEndian2Int(substr($boxdata, 10, 2)); $num_total = getid3_lib::BigEndian2Int(substr($boxdata, 12, 2)); $atom_structure['data'] = empty($num) ? '' : $num; @@ -379,21 +466,25 @@ class getid3_quicktime extends getid3_handler break; case 'gnre': + // enum $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); break; case 'rtng': + // 8-bit integer $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); $atom_structure['data'] = $this->QuicktimeContentRatingLookup($atom_structure[$atomname]); break; case 'stik': + // 8-bit integer (enum) $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 1)); $atom_structure['data'] = $this->QuicktimeSTIKLookup($atom_structure[$atomname]); break; case 'sfID': + // 32-bit integer $atom_structure[$atomname] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); $atom_structure['data'] = $this->QuicktimeStoreFrontCodeLookup($atom_structure[$atomname]); break; @@ -403,7 +494,18 @@ class getid3_quicktime extends getid3_handler $atom_structure['data'] = substr($boxdata, 8); break; + case 'plID': + // 64-bit integer + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 8)); + break; + + case 'atID': + case 'cnID': + case 'geID': + case 'tves': + case 'tvsn': default: + // 32-bit integer $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); } break; @@ -928,13 +1030,13 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ for ($i = 0; $i < $atom_structure['number_entries']; $i++) { $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4)); $drefDataOffset += 4; - $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); + $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); $drefDataOffset += 4; $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); $drefDataOffset += 1; $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 $drefDataOffset += 3; - $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); + $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001); @@ -1004,7 +1106,7 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ $info['error'][] = 'Corrupt Quicktime file: mdhd.time_scale == zero'; return false; } - $info['quicktime']['time_scale'] = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); + $info['quicktime']['time_scale'] = ((isset($info['quicktime']['time_scale']) && ($info['quicktime']['time_scale'] < 1000)) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); @@ -1019,7 +1121,7 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ case 'pnot': // Preview atom $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 - $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' + $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01 $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']); @@ -1029,7 +1131,7 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ case 'crgn': // Clipping ReGioN atom $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields - $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. + $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. break; @@ -1120,7 +1222,7 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ } $atom_structure['creation_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['creation_time']); $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); - $info['quicktime']['time_scale'] = (isset($info['quicktime']['time_scale']) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); + $info['quicktime']['time_scale'] = ((isset($info['quicktime']['time_scale']) && ($info['quicktime']['time_scale'] < 1000)) ? max($info['quicktime']['time_scale'], $atom_structure['time_scale']) : $atom_structure['time_scale']); $info['quicktime']['display_scale'] = $atom_structure['matrix_a']; $info['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; break; @@ -1240,14 +1342,20 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ } // check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field - while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) + while (($mdat_offset < (strlen($atom_data) - 8)) + && ($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) && ($chapter_string_length < 1000) && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2)) - && preg_match('#^[\x20-\xFF]+$#', substr($atom_data, $mdat_offset + 2, $chapter_string_length), $chapter_matches)) { + && preg_match('#^([\x00-\xFF]{2})([\x20-\xFF]+)$#', substr($atom_data, $mdat_offset, $chapter_string_length + 2), $chapter_matches)) { + list($dummy, $chapter_string_length_hex, $chapter_string) = $chapter_matches; $mdat_offset += (2 + $chapter_string_length); - @$info['quicktime']['comments']['chapters'][] = $chapter_matches[0]; - } + @$info['quicktime']['comments']['chapters'][] = $chapter_string; + // "encd" atom specifies encoding. In theory could be anything, almost always UTF-8, but may be UTF-16 with BOM (not currently handled) + if (substr($atom_data, $mdat_offset, 12) == "\x00\x00\x00\x0C\x65\x6E\x63\x64\x00\x00\x01\x00") { // UTF-8 + $mdat_offset += 12; + } + } if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { @@ -1397,22 +1505,53 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ break; case "\x00\x00\x00\x00": - case 'meta': // METAdata atom // some kind of metacontainer, may contain a big data dump such as: // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); - $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); break; + case 'meta': // METAdata atom + // https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html + + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); + break; + case 'data': // metaDATA atom + static $metaDATAkey = 1; // real ugly, but so is the QuickTime structure that stores keys and values in different multinested locations that are hard to relate to each other // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data $atom_structure['language'] = substr($atom_data, 4 + 0, 2); $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); $atom_structure['data'] = substr($atom_data, 4 + 4); + $atom_structure['key_name'] = @$info['quicktime']['temp_meta_key_names'][$metaDATAkey++]; + + if ($atom_structure['key_name'] && $atom_structure['data']) { + @$info['quicktime']['comments'][str_replace('com.apple.quicktime.', '', $atom_structure['key_name'])][] = $atom_structure['data']; + } + break; + + case 'keys': // KEYS that may be present in the metadata atom. + // https://developer.apple.com/library/mac/documentation/QuickTime/QTFF/Metadata/Metadata.html#//apple_ref/doc/uid/TP40000939-CH1-SW21 + // The metadata item keys atom holds a list of the metadata keys that may be present in the metadata atom. + // This list is indexed starting with 1; 0 is a reserved index value. The metadata item keys atom is a full atom with an atom type of "keys". + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); + $atom_structure['entry_count'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); + $keys_atom_offset = 8; + for ($i = 1; $i <= $atom_structure['entry_count']; $i++) { + $atom_structure['keys'][$i]['key_size'] = getid3_lib::BigEndian2Int(substr($atom_data, $keys_atom_offset + 0, 4)); + $atom_structure['keys'][$i]['key_namespace'] = substr($atom_data, $keys_atom_offset + 4, 4); + $atom_structure['keys'][$i]['key_value'] = substr($atom_data, $keys_atom_offset + 8, $atom_structure['keys'][$i]['key_size'] - 8); + $keys_atom_offset += $atom_structure['keys'][$i]['key_size']; // key_size includes the 4+4 bytes for key_size and key_namespace + + $info['quicktime']['temp_meta_key_names'][$i] = $atom_structure['keys'][$i]['key_value']; + } break; default: @@ -1753,56 +1892,56 @@ if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($ static $QuicktimeIODSaudioProfileNameLookup = array(); if (empty($QuicktimeIODSaudioProfileNameLookup)) { $QuicktimeIODSaudioProfileNameLookup = array( - 0x00 => 'ISO Reserved (0x00)', - 0x01 => 'Main Audio Profile @ Level 1', - 0x02 => 'Main Audio Profile @ Level 2', - 0x03 => 'Main Audio Profile @ Level 3', - 0x04 => 'Main Audio Profile @ Level 4', - 0x05 => 'Scalable Audio Profile @ Level 1', - 0x06 => 'Scalable Audio Profile @ Level 2', - 0x07 => 'Scalable Audio Profile @ Level 3', - 0x08 => 'Scalable Audio Profile @ Level 4', - 0x09 => 'Speech Audio Profile @ Level 1', - 0x0A => 'Speech Audio Profile @ Level 2', - 0x0B => 'Synthetic Audio Profile @ Level 1', - 0x0C => 'Synthetic Audio Profile @ Level 2', - 0x0D => 'Synthetic Audio Profile @ Level 3', - 0x0E => 'High Quality Audio Profile @ Level 1', - 0x0F => 'High Quality Audio Profile @ Level 2', - 0x10 => 'High Quality Audio Profile @ Level 3', - 0x11 => 'High Quality Audio Profile @ Level 4', - 0x12 => 'High Quality Audio Profile @ Level 5', - 0x13 => 'High Quality Audio Profile @ Level 6', - 0x14 => 'High Quality Audio Profile @ Level 7', - 0x15 => 'High Quality Audio Profile @ Level 8', - 0x16 => 'Low Delay Audio Profile @ Level 1', - 0x17 => 'Low Delay Audio Profile @ Level 2', - 0x18 => 'Low Delay Audio Profile @ Level 3', - 0x19 => 'Low Delay Audio Profile @ Level 4', - 0x1A => 'Low Delay Audio Profile @ Level 5', - 0x1B => 'Low Delay Audio Profile @ Level 6', - 0x1C => 'Low Delay Audio Profile @ Level 7', - 0x1D => 'Low Delay Audio Profile @ Level 8', - 0x1E => 'Natural Audio Profile @ Level 1', - 0x1F => 'Natural Audio Profile @ Level 2', - 0x20 => 'Natural Audio Profile @ Level 3', - 0x21 => 'Natural Audio Profile @ Level 4', - 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', - 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', - 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', - 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', - 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', - 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', - 0x28 => 'AAC Profile @ Level 1', - 0x29 => 'AAC Profile @ Level 2', - 0x2A => 'AAC Profile @ Level 4', - 0x2B => 'AAC Profile @ Level 5', - 0x2C => 'High Efficiency AAC Profile @ Level 2', - 0x2D => 'High Efficiency AAC Profile @ Level 3', - 0x2E => 'High Efficiency AAC Profile @ Level 4', - 0x2F => 'High Efficiency AAC Profile @ Level 5', - 0xFE => 'Not part of MPEG-4 audio profiles', - 0xFF => 'No audio capability required', + 0x00 => 'ISO Reserved (0x00)', + 0x01 => 'Main Audio Profile @ Level 1', + 0x02 => 'Main Audio Profile @ Level 2', + 0x03 => 'Main Audio Profile @ Level 3', + 0x04 => 'Main Audio Profile @ Level 4', + 0x05 => 'Scalable Audio Profile @ Level 1', + 0x06 => 'Scalable Audio Profile @ Level 2', + 0x07 => 'Scalable Audio Profile @ Level 3', + 0x08 => 'Scalable Audio Profile @ Level 4', + 0x09 => 'Speech Audio Profile @ Level 1', + 0x0A => 'Speech Audio Profile @ Level 2', + 0x0B => 'Synthetic Audio Profile @ Level 1', + 0x0C => 'Synthetic Audio Profile @ Level 2', + 0x0D => 'Synthetic Audio Profile @ Level 3', + 0x0E => 'High Quality Audio Profile @ Level 1', + 0x0F => 'High Quality Audio Profile @ Level 2', + 0x10 => 'High Quality Audio Profile @ Level 3', + 0x11 => 'High Quality Audio Profile @ Level 4', + 0x12 => 'High Quality Audio Profile @ Level 5', + 0x13 => 'High Quality Audio Profile @ Level 6', + 0x14 => 'High Quality Audio Profile @ Level 7', + 0x15 => 'High Quality Audio Profile @ Level 8', + 0x16 => 'Low Delay Audio Profile @ Level 1', + 0x17 => 'Low Delay Audio Profile @ Level 2', + 0x18 => 'Low Delay Audio Profile @ Level 3', + 0x19 => 'Low Delay Audio Profile @ Level 4', + 0x1A => 'Low Delay Audio Profile @ Level 5', + 0x1B => 'Low Delay Audio Profile @ Level 6', + 0x1C => 'Low Delay Audio Profile @ Level 7', + 0x1D => 'Low Delay Audio Profile @ Level 8', + 0x1E => 'Natural Audio Profile @ Level 1', + 0x1F => 'Natural Audio Profile @ Level 2', + 0x20 => 'Natural Audio Profile @ Level 3', + 0x21 => 'Natural Audio Profile @ Level 4', + 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', + 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', + 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', + 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', + 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', + 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', + 0x28 => 'AAC Profile @ Level 1', + 0x29 => 'AAC Profile @ Level 2', + 0x2A => 'AAC Profile @ Level 4', + 0x2B => 'AAC Profile @ Level 5', + 0x2C => 'High Efficiency AAC Profile @ Level 2', + 0x2D => 'High Efficiency AAC Profile @ Level 3', + 0x2E => 'High Efficiency AAC Profile @ Level 4', + 0x2F => 'High Efficiency AAC Profile @ Level 5', + 0xFE => 'Not part of MPEG-4 audio profiles', + 0xFF => 'No audio capability required', ); } return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private'); @@ -2111,8 +2250,18 @@ echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { static $handyatomtranslatorarray = array(); if (empty($handyatomtranslatorarray)) { + // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt + // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt + // http://atomicparsley.sourceforge.net/mpeg-4files.html + // https://code.google.com/p/mp4v2/wiki/iTunesMetadata + $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; + $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'aut'] = 'author'; + $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'com'] = 'comment'; $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright'; - $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 $handyatomtranslatorarray["\xA9".'dir'] = 'director'; $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1'; $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2'; @@ -2123,64 +2272,60 @@ echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br $handyatomtranslatorarray["\xA9".'ed7'] = 'edit7'; $handyatomtranslatorarray["\xA9".'ed8'] = 'edit8'; $handyatomtranslatorarray["\xA9".'ed9'] = 'edit9'; + $handyatomtranslatorarray["\xA9".'enc'] = 'encoded_by'; $handyatomtranslatorarray["\xA9".'fmt'] = 'format'; + $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 + $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; $handyatomtranslatorarray["\xA9".'inf'] = 'information'; + $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 + $handyatomtranslatorarray["\xA9".'mak'] = 'make'; + $handyatomtranslatorarray["\xA9".'mod'] = 'model'; + $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; $handyatomtranslatorarray["\xA9".'prd'] = 'producer'; + $handyatomtranslatorarray["\xA9".'PRD'] = 'product'; $handyatomtranslatorarray["\xA9".'prf'] = 'performers'; $handyatomtranslatorarray["\xA9".'req'] = 'system_requirements'; $handyatomtranslatorarray["\xA9".'src'] = 'source_credit'; - $handyatomtranslatorarray["\xA9".'wrt'] = 'writer'; - - // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt - $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; - $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; - $handyatomtranslatorarray["\xA9".'mak'] = 'make'; - $handyatomtranslatorarray["\xA9".'mod'] = 'model'; - $handyatomtranslatorarray["\xA9".'PRD'] = 'product'; $handyatomtranslatorarray["\xA9".'swr'] = 'software'; - $handyatomtranslatorarray["\xA9".'aut'] = 'author'; - $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; + $handyatomtranslatorarray["\xA9".'too'] = 'encoding_tool'; // iTunes 4.0 $handyatomtranslatorarray["\xA9".'trk'] = 'track'; - $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'com'] = 'comment'; - $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; $handyatomtranslatorarray["\xA9".'url'] = 'url'; - $handyatomtranslatorarray["\xA9".'enc'] = 'encoder'; - - // http://atomicparsley.sourceforge.net/mpeg-4files.html - $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 + $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; + $handyatomtranslatorarray["\xA9".'wrt'] = 'composer'; $handyatomtranslatorarray['aART'] = 'album_artist'; - $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 - $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 - $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 - $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 - $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? - $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 - $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 - $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 - $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 - $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 - $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 - $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 - $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 - $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 - $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 - $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 - $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 - $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 - $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 - $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 - $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 - $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 - $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0 - - // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt - - + $handyatomtranslatorarray['apID'] = 'purchase_account'; + $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 + $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 + $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 + $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? + $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 + $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 + $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 + $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 + $handyatomtranslatorarray['hdvd'] = 'hd_video'; // iTunes 4.0 + $handyatomtranslatorarray['ldes'] = 'description_long'; // + $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 + $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 + $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0 + $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 + $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 + $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 + $handyatomtranslatorarray['soaa'] = 'sort_album_artist'; // + $handyatomtranslatorarray['soal'] = 'sort_album'; // + $handyatomtranslatorarray['soar'] = 'sort_artist'; // + $handyatomtranslatorarray['soco'] = 'sort_composer'; // + $handyatomtranslatorarray['sonm'] = 'sort_title'; // + $handyatomtranslatorarray['sosn'] = 'sort_show'; // + $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 + $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 + $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 + $handyatomtranslatorarray['tven'] = 'tv_episode_id'; // + $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 + $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 + $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 + $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 // boxnames: /* @@ -2225,7 +2370,14 @@ echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br $data = array('data'=>$data, 'image_mime'=>$image_mime); } } - $info['quicktime']['comments'][$comment_key][] = $data; + $gooddata = array($data); + if ($comment_key == 'genre') { + // some other taggers separate multiple genres with semicolon, e.g. "Heavy Metal;Thrash Metal;Metal" + $gooddata = explode(';', $data); + } + foreach ($gooddata as $data) { + $info['quicktime']['comments'][$comment_key][] = $data; + } } return true; } @@ -2243,4 +2395,79 @@ echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.'<br return substr($pascalstring, 1); } + + /* + // helper functions for m4b audiobook chapters + // code by Steffen Hartmann 2015-Nov-08 + */ + public function search_tag_by_key($info, $tag, $history, &$result) { + foreach ($info as $key => $value) { + $key_history = $history.'/'.$key; + if ($key === $tag) { + $result[] = array($key_history, $info); + } else { + if (is_array($value)) { + $this->search_tag_by_key($value, $tag, $key_history, $result); + } + } + } + } + + public function search_tag_by_pair($info, $k, $v, $history, &$result) { + foreach ($info as $key => $value) { + $key_history = $history.'/'.$key; + if (($key === $k) && ($value === $v)) { + $result[] = array($key_history, $info); + } else { + if (is_array($value)) { + $this->search_tag_by_pair($value, $k, $v, $key_history, $result); + } + } + } + } + + public function quicktime_time_to_sample_table($info) { + $res = array(); + $this->search_tag_by_pair($info['quicktime']['moov'], 'name', 'stbl', 'quicktime/moov', $res); + foreach ($res as $value) { + $stbl_res = array(); + $this->search_tag_by_pair($value[1], 'data_format', 'text', $value[0], $stbl_res); + if (count($stbl_res) > 0) { + $stts_res = array(); + $this->search_tag_by_key($value[1], 'time_to_sample_table', $value[0], $stts_res); + if (count($stts_res) > 0) { + return $stts_res[0][1]['time_to_sample_table']; + } + } + } + return array(); + } + + function quicktime_bookmark_time_scale($info) { + $time_scale = ''; + $ts_prefix_len = 0; + $res = array(); + $this->search_tag_by_pair($info['quicktime']['moov'], 'name', 'stbl', 'quicktime/moov', $res); + foreach ($res as $value) { + $stbl_res = array(); + $this->search_tag_by_pair($value[1], 'data_format', 'text', $value[0], $stbl_res); + if (count($stbl_res) > 0) { + $ts_res = array(); + $this->search_tag_by_key($info['quicktime']['moov'], 'time_scale', 'quicktime/moov', $ts_res); + foreach ($ts_res as $value) { + $prefix = substr($value[0], 0, -12); + if ((substr($stbl_res[0][0], 0, strlen($prefix)) === $prefix) && ($ts_prefix_len < strlen($prefix))) { + $time_scale = $value[1]['time_scale']; + $ts_prefix_len = strlen($prefix); + } + } + } + } + return $time_scale; + } + /* + // END helper functions for m4b audiobook chapters + */ + + } diff --git a/app/Library/getid3/getid3/module.audio-video.real.php b/app/Library/getid3/getid3/module.audio-video.real.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.riff.php b/app/Library/getid3/getid3/module.audio-video.riff.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.swf.php b/app/Library/getid3/getid3/module.audio-video.swf.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio-video.ts.php b/app/Library/getid3/getid3/module.audio-video.ts.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.aa.php b/app/Library/getid3/getid3/module.audio.aa.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.aac.php b/app/Library/getid3/getid3/module.audio.aac.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.ac3.php b/app/Library/getid3/getid3/module.audio.ac3.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.amr.php b/app/Library/getid3/getid3/module.audio.amr.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.au.php b/app/Library/getid3/getid3/module.audio.au.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.avr.php b/app/Library/getid3/getid3/module.audio.avr.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.bonk.php b/app/Library/getid3/getid3/module.audio.bonk.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.dss.php b/app/Library/getid3/getid3/module.audio.dss.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.dts.php b/app/Library/getid3/getid3/module.audio.dts.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.flac.php b/app/Library/getid3/getid3/module.audio.flac.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.la.php b/app/Library/getid3/getid3/module.audio.la.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.lpac.php b/app/Library/getid3/getid3/module.audio.lpac.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.midi.php b/app/Library/getid3/getid3/module.audio.midi.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.mod.php b/app/Library/getid3/getid3/module.audio.mod.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.monkey.php b/app/Library/getid3/getid3/module.audio.monkey.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.mp3.php b/app/Library/getid3/getid3/module.audio.mp3.php old mode 100755 new mode 100644 index 329f7a67..cba36193 --- a/app/Library/getid3/getid3/module.audio.mp3.php +++ b/app/Library/getid3/getid3/module.audio.mp3.php @@ -437,7 +437,6 @@ class getid3_mp3 extends getid3_handler // and $cc... is the audio data $head4 = substr($headerstring, 0, 4); - static $MPEGaudioHeaderDecodeCache = array(); if (isset($MPEGaudioHeaderDecodeCache[$head4])) { $MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4]; @@ -648,9 +647,20 @@ class getid3_mp3 extends getid3_handler } //if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { - if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { + //if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { + if (!empty($thisfile_mpeg_audio['VBR_frames'])) { + $used_filesize = 0; + if (!empty($thisfile_mpeg_audio['VBR_bytes'])) { + $used_filesize = $thisfile_mpeg_audio['VBR_bytes']; + } elseif (!empty($info['filesize'])) { + $used_filesize = $info['filesize']; + $used_filesize -= intval(@$info['id3v2']['headerlength']); + $used_filesize -= (isset($info['id3v1']) ? 128 : 0); + $used_filesize -= (isset($info['tag_offset_end']) ? $info['tag_offset_end'] - $info['tag_offset_start'] : 0); + $info['warning'][] = 'MP3.Xing header missing VBR_bytes, assuming MPEG audio portion of file is '.number_format($used_filesize).' bytes'; + } - $framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']; + $framelengthfloat = $used_filesize / $thisfile_mpeg_audio['VBR_frames']; if ($thisfile_mpeg_audio['layer'] == '1') { // BitRate = (((FrameLengthInBytes / 4) - Padding) * SampleRate) / 12 @@ -948,7 +958,7 @@ class getid3_mp3 extends getid3_handler } $thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0); if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) { - $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; + $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion } break; diff --git a/app/Library/getid3/getid3/module.audio.mpc.php b/app/Library/getid3/getid3/module.audio.mpc.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.ogg.php b/app/Library/getid3/getid3/module.audio.ogg.php old mode 100755 new mode 100644 index 2a77768b..3ebf8faa --- a/app/Library/getid3/getid3/module.audio.ogg.php +++ b/app/Library/getid3/getid3/module.audio.ogg.php @@ -562,6 +562,7 @@ $info['warning'][] = 'Ogg Theora (v3) not fully supported in this version of get default: return false; + break; } $VendorSize = getid3_lib::LittleEndian2Int(substr($commentdata, $commentdataoffset, 4)); diff --git a/app/Library/getid3/getid3/module.audio.optimfrog.php b/app/Library/getid3/getid3/module.audio.optimfrog.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.rkau.php b/app/Library/getid3/getid3/module.audio.rkau.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.shorten.php b/app/Library/getid3/getid3/module.audio.shorten.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.tta.php b/app/Library/getid3/getid3/module.audio.tta.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.voc.php b/app/Library/getid3/getid3/module.audio.voc.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.vqf.php b/app/Library/getid3/getid3/module.audio.vqf.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.audio.wavpack.php b/app/Library/getid3/getid3/module.audio.wavpack.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.bmp.php b/app/Library/getid3/getid3/module.graphic.bmp.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.efax.php b/app/Library/getid3/getid3/module.graphic.efax.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.gif.php b/app/Library/getid3/getid3/module.graphic.gif.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.jpg.php b/app/Library/getid3/getid3/module.graphic.jpg.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.pcd.php b/app/Library/getid3/getid3/module.graphic.pcd.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.png.php b/app/Library/getid3/getid3/module.graphic.png.php old mode 100755 new mode 100644 index 11ae3ede..0ce82a69 --- a/app/Library/getid3/getid3/module.graphic.png.php +++ b/app/Library/getid3/getid3/module.graphic.png.php @@ -17,8 +17,10 @@ class getid3_png extends getid3_handler { + public $max_data_bytes = 10000000; // if data chunk is larger than this do not read it completely (getID3 only needs the first few dozen bytes for parsing) public function Analyze() { + $info = &$this->getid3->info; // shortcut @@ -44,14 +46,24 @@ class getid3_png extends getid3_handler while ((($this->ftell() - (strlen($PNGfiledata) - $offset)) < $info['filesize'])) { $chunk['data_length'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4)); - $offset += 4; - while (((strlen($PNGfiledata) - $offset) < ($chunk['data_length'] + 4)) && ($this->ftell() < $info['filesize'])) { - $PNGfiledata .= $this->fread($this->getid3->fread_buffer_size()); + if ($chunk['data_length'] === false) { + $info['error'][] = 'Failed to read data_length at offset '.$offset; + return false; } - $chunk['type_text'] = substr($PNGfiledata, $offset, 4); + $offset += 4; + $truncated_data = false; + while (((strlen($PNGfiledata) - $offset) < ($chunk['data_length'] + 4)) && ($this->ftell() < $info['filesize'])) { + if (strlen($PNGfiledata) < $this->max_data_bytes) { + $PNGfiledata .= $this->fread($this->getid3->fread_buffer_size()); + } else { + $info['warning'][] = 'At offset '.$offset.' chunk "'.substr($PNGfiledata, $offset, 4).'" exceeded max_data_bytes value of '.$this->max_data_bytes.', data chunk will be truncated at '.(strlen($PNGfiledata) - 8).' bytes'; + break; + } + } + $chunk['type_text'] = substr($PNGfiledata, $offset, 4); $offset += 4; $chunk['type_raw'] = getid3_lib::BigEndian2Int($chunk['type_text']); - $chunk['data'] = substr($PNGfiledata, $offset, $chunk['data_length']); + $chunk['data'] = substr($PNGfiledata, $offset, $chunk['data_length']); $offset += $chunk['data_length']; $chunk['crc'] = getid3_lib::BigEndian2Int(substr($PNGfiledata, $offset, 4)); $offset += 4; @@ -162,7 +174,7 @@ class getid3_png extends getid3_handler case 'iCCP': // Embedded ICC Profile $thisfile_png_chunk_type_text['header'] = $chunk; - list($profilename, $compressiondata) = explode("\x00", $chunk['data'], 2); + list($profilename, $compressiondata) = explode("\x00", $chunk['data'], 2); $thisfile_png_chunk_type_text['profile_name'] = $profilename; $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($compressiondata, 0, 1)); $thisfile_png_chunk_type_text['compression_profile'] = substr($compressiondata, 1); @@ -173,7 +185,7 @@ class getid3_png extends getid3_handler case 'tEXt': // Textual Data $thisfile_png_chunk_type_text['header'] = $chunk; - list($keyword, $text) = explode("\x00", $chunk['data'], 2); + list($keyword, $text) = explode("\x00", $chunk['data'], 2); $thisfile_png_chunk_type_text['keyword'] = $keyword; $thisfile_png_chunk_type_text['text'] = $text; @@ -183,7 +195,7 @@ class getid3_png extends getid3_handler case 'zTXt': // Compressed Textual Data $thisfile_png_chunk_type_text['header'] = $chunk; - list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); + list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); $thisfile_png_chunk_type_text['keyword'] = $keyword; $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 0, 1)); $thisfile_png_chunk_type_text['compressed_text'] = substr($otherdata, 1); @@ -206,7 +218,7 @@ class getid3_png extends getid3_handler case 'iTXt': // International Textual Data $thisfile_png_chunk_type_text['header'] = $chunk; - list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); + list($keyword, $otherdata) = explode("\x00", $chunk['data'], 2); $thisfile_png_chunk_type_text['keyword'] = $keyword; $thisfile_png_chunk_type_text['compression'] = (bool) getid3_lib::BigEndian2Int(substr($otherdata, 0, 1)); $thisfile_png_chunk_type_text['compression_method'] = getid3_lib::BigEndian2Int(substr($otherdata, 1, 1)); @@ -307,7 +319,7 @@ class getid3_png extends getid3_handler case 'sPLT': // Suggested Palette $thisfile_png_chunk_type_text['header'] = $chunk; - list($palettename, $otherdata) = explode("\x00", $chunk['data'], 2); + list($palettename, $otherdata) = explode("\x00", $chunk['data'], 2); $thisfile_png_chunk_type_text['palette_name'] = $palettename; $sPLToffset = 0; $thisfile_png_chunk_type_text['sample_depth_bits'] = getid3_lib::BigEndian2Int(substr($otherdata, $sPLToffset, 1)); diff --git a/app/Library/getid3/getid3/module.graphic.svg.php b/app/Library/getid3/getid3/module.graphic.svg.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.graphic.tiff.php b/app/Library/getid3/getid3/module.graphic.tiff.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.misc.cue.php b/app/Library/getid3/getid3/module.misc.cue.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.misc.exe.php b/app/Library/getid3/getid3/module.misc.exe.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.misc.iso.php b/app/Library/getid3/getid3/module.misc.iso.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.misc.msoffice.php b/app/Library/getid3/getid3/module.misc.msoffice.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.misc.par2.php b/app/Library/getid3/getid3/module.misc.par2.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.misc.pdf.php b/app/Library/getid3/getid3/module.misc.pdf.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.tag.apetag.php b/app/Library/getid3/getid3/module.tag.apetag.php old mode 100755 new mode 100644 index 724b8b0f..819e5e33 --- a/app/Library/getid3/getid3/module.tag.apetag.php +++ b/app/Library/getid3/getid3/module.tag.apetag.php @@ -260,12 +260,16 @@ class getid3_apetag extends getid3_handler $thisfile_ape_items_current['data_offset'] = $thisfile_ape_items_current['offset'] + strlen($thisfile_ape_items_current['filename']."\x00"); $thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']); - $thisfile_ape_items_current['image_mime'] = ''; - $imageinfo = array(); - $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo); - $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); - do { + $thisfile_ape_items_current['image_mime'] = ''; + $imageinfo = array(); + $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo); + if (($imagechunkcheck === false) || !isset($imagechunkcheck[2])) { + $info['warning'][] = 'APEtag "'.$item_key.'" contains invalid image data'; + break; + } + $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); + if ($this->inline_attachments === false) { // skip entirely unset($thisfile_ape_items_current['data']); diff --git a/app/Library/getid3/getid3/module.tag.id3v1.php b/app/Library/getid3/getid3/module.tag.id3v1.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.tag.id3v2.php b/app/Library/getid3/getid3/module.tag.id3v2.php old mode 100755 new mode 100644 index 70925048..de334135 --- a/app/Library/getid3/getid3/module.tag.id3v2.php +++ b/app/Library/getid3/getid3/module.tag.id3v2.php @@ -442,10 +442,14 @@ class getid3_id3v2 extends getid3_handler } // end footer if (isset($thisfile_id3v2['comments']['genre'])) { + $genres = array(); foreach ($thisfile_id3v2['comments']['genre'] as $key => $value) { - unset($thisfile_id3v2['comments']['genre'][$key]); - $thisfile_id3v2['comments'] = getid3_lib::array_merge_noclobber($thisfile_id3v2['comments'], array('genre'=>$this->ParseID3v2GenreString($value))); + foreach ($this->ParseID3v2GenreString($value) as $genre) { + $genres[] = $genre; + } } + $thisfile_id3v2['comments']['genre'] = array_unique($genres); + unset($key, $value, $genres, $genre); } if (isset($thisfile_id3v2['comments']['track'])) { @@ -503,6 +507,16 @@ class getid3_id3v2 extends getid3_handler if (strpos($genrestring, "\x00") === false) { $genrestring = preg_replace('#\(([0-9]{1,3})\)#', '$1'."\x00", $genrestring); } + + // note: MusicBrainz Picard incorrectly stores plaintext genres separated by "/" when writing in ID3v2.3 mode, hack-fix here: + // replace / with NULL, then replace back the two ID3v1 genres that legitimately have "/" as part of the single genre name + $genrestring = str_replace('/', "\x00", $genrestring); + $genrestring = str_replace('Pop'."\x00".'Funk', 'Pop/Funk', $genrestring); + $genrestring = str_replace('Rock'."\x00".'Rock', 'Folk/Rock', $genrestring); + + // some other taggers separate multiple genres with semicolon, e.g. "Heavy Metal;Thrash Metal;Metal" + $genrestring = str_replace(';', "\x00", $genrestring); + $genre_elements = explode("\x00", $genrestring); foreach ($genre_elements as $element) { $element = trim($element); @@ -635,7 +649,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $parsedFrame['encodingid'] = $frame_textencoding; @@ -728,8 +743,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); @@ -971,7 +986,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); @@ -979,7 +995,6 @@ class getid3_id3v2 extends getid3_handler $parsedFrame['encodingid'] = $frame_textencoding; $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); - $parsedFrame['data'] = $parsedFrame['data']; $parsedFrame['language'] = $frame_language; $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); $parsedFrame['description'] = $frame_description; @@ -1079,7 +1094,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $frame_text = (string) substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); @@ -1383,7 +1399,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $parsedFrame['encodingid'] = $frame_textencoding; @@ -1402,14 +1419,15 @@ class getid3_id3v2 extends getid3_handler $parsedFrame['image_mime'] = ''; $imageinfo = array(); - $imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo); - if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { - $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); - if ($imagechunkcheck[0]) { - $parsedFrame['image_width'] = $imagechunkcheck[0]; - } - if ($imagechunkcheck[1]) { - $parsedFrame['image_height'] = $imagechunkcheck[1]; + if ($imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo)) { + if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { + $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); + if ($imagechunkcheck[0]) { + $parsedFrame['image_width'] = $imagechunkcheck[0]; + } + if ($imagechunkcheck[1]) { + $parsedFrame['image_height'] = $imagechunkcheck[1]; + } } } @@ -1507,7 +1525,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); @@ -1589,7 +1608,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); @@ -1614,7 +1634,7 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos = strpos($parsedFrame['data'], "\x00", $frame_offset); $frame_ownerid = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); if (ord($frame_ownerid) === 0) { - $frame_ownerid == ''; + $frame_ownerid = ''; } $frame_offset = $frame_terminatorpos + strlen("\x00"); $parsedFrame['ownerid'] = $frame_ownerid; @@ -1789,7 +1809,8 @@ class getid3_id3v2 extends getid3_handler $frame_terminatorpos++; // strpos() fooled because 2nd byte of Unicode chars are often 0x00 } $frame_description = substr($parsedFrame['data'], $frame_offset, $frame_terminatorpos - $frame_offset); - if (ord($frame_description) === 0) { + if (in_array($frame_description, array("\x00", "\x00\x00", "\xFF\xFE", "\xFE\xFF"))) { + // if description only contains a BOM or terminator then make it blank $frame_description = ''; } $frame_offset = $frame_terminatorpos + strlen($frame_textencoding_terminator); diff --git a/app/Library/getid3/getid3/module.tag.lyrics3.php b/app/Library/getid3/getid3/module.tag.lyrics3.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/module.tag.xmp.php b/app/Library/getid3/getid3/module.tag.xmp.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/write.apetag.php b/app/Library/getid3/getid3/write.apetag.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/write.id3v1.php b/app/Library/getid3/getid3/write.id3v1.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/write.id3v2.php b/app/Library/getid3/getid3/write.id3v2.php old mode 100755 new mode 100644 index 7b6eaa1d..236e2ff4 --- a/app/Library/getid3/getid3/write.id3v2.php +++ b/app/Library/getid3/getid3/write.id3v2.php @@ -1759,10 +1759,15 @@ class getid3_write_id3v2 } public function ID3v2IsValidTextEncoding($textencodingbyte) { + // 0 = ISO-8859-1 + // 1 = UTF-16 with BOM + // 2 = UTF-16BE without BOM + // 3 = UTF-8 static $ID3v2IsValidTextEncoding_cache = array( - 2 => array(true, true), - 3 => array(true, true), - 4 => array(true, true, true, true)); + 2 => array(true, true), // ID3v2.2 - allow 0=ISO-8859-1, 1=UTF-16 + 3 => array(true, true), // ID3v2.3 - allow 0=ISO-8859-1, 1=UTF-16 + 4 => array(true, true, true, true), // ID3v2.4 - allow 0=ISO-8859-1, 1=UTF-16, 2=UTF-16BE, 3=UTF-8 + ); return isset($ID3v2IsValidTextEncoding_cache[$this->majorversion][$textencodingbyte]); } @@ -1906,6 +1911,7 @@ class getid3_write_id3v2 $ID3v2ShortFrameNameLookup[2]['comment'] = 'COM'; $ID3v2ShortFrameNameLookup[2]['album'] = 'TAL'; $ID3v2ShortFrameNameLookup[2]['beats_per_minute'] = 'TBP'; + $ID3v2ShortFrameNameLookup[2]['bpm'] = 'TBP'; $ID3v2ShortFrameNameLookup[2]['composer'] = 'TCM'; $ID3v2ShortFrameNameLookup[2]['genre'] = 'TCO'; $ID3v2ShortFrameNameLookup[2]['itunescompilation'] = 'TCP'; @@ -1966,6 +1972,7 @@ class getid3_write_id3v2 $ID3v2ShortFrameNameLookup[3]['synchronised_tempo_codes'] = 'SYTC'; $ID3v2ShortFrameNameLookup[3]['album'] = 'TALB'; $ID3v2ShortFrameNameLookup[3]['beats_per_minute'] = 'TBPM'; + $ID3v2ShortFrameNameLookup[3]['bpm'] = 'TBPM'; $ID3v2ShortFrameNameLookup[3]['itunescompilation'] = 'TCMP'; $ID3v2ShortFrameNameLookup[3]['composer'] = 'TCOM'; $ID3v2ShortFrameNameLookup[3]['genre'] = 'TCON'; diff --git a/app/Library/getid3/getid3/write.lyrics3.php b/app/Library/getid3/getid3/write.lyrics3.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/write.metaflac.php b/app/Library/getid3/getid3/write.metaflac.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/write.php b/app/Library/getid3/getid3/write.php old mode 100755 new mode 100644 index 4c3ed620..9a7ec519 --- a/app/Library/getid3/getid3/write.php +++ b/app/Library/getid3/getid3/write.php @@ -23,7 +23,7 @@ if (!defined('GETID3_INCLUDEPATH')) { throw new Exception('getid3.php MUST be included before calling getid3_writetags'); } -if (!include_once(GETID3_INCLUDEPATH . 'getid3.lib.php')) { +if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { throw new Exception('write.php depends on getid3.lib.php, which is missing.'); } diff --git a/app/Library/getid3/getid3/write.real.php b/app/Library/getid3/getid3/write.real.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/getid3/write.vorbiscomment.php b/app/Library/getid3/getid3/write.vorbiscomment.php old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/head.exe b/app/Library/getid3/helperapps/head.exe old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/md5sum.exe b/app/Library/getid3/helperapps/md5sum.exe old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/metaflac.exe b/app/Library/getid3/helperapps/metaflac.exe old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/readme.helperapps.txt b/app/Library/getid3/helperapps/readme.helperapps.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/shorten.exe b/app/Library/getid3/helperapps/shorten.exe old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/tail.exe b/app/Library/getid3/helperapps/tail.exe old mode 100755 new mode 100644 diff --git a/app/Library/getid3/helperapps/vorbiscomment.exe b/app/Library/getid3/helperapps/vorbiscomment.exe old mode 100755 new mode 100644 diff --git a/app/Library/getid3/license.txt b/app/Library/getid3/license.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/licenses/licence.gpl-10.txt b/app/Library/getid3/licenses/licence.gpl-10.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/licenses/licence.gpl-20.txt b/app/Library/getid3/licenses/licence.gpl-20.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/licenses/licence.gpl-30.txt b/app/Library/getid3/licenses/licence.gpl-30.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/licenses/licence.lgpl-30.txt b/app/Library/getid3/licenses/licence.lgpl-30.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/licenses/licence.mpl-20.txt b/app/Library/getid3/licenses/licence.mpl-20.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/licenses/license.commercial.txt b/app/Library/getid3/licenses/license.commercial.txt old mode 100755 new mode 100644 diff --git a/app/Library/getid3/readme.txt b/app/Library/getid3/readme.txt old mode 100755 new mode 100644 index deebf4dc..04dca2eb --- a/app/Library/getid3/readme.txt +++ b/app/Library/getid3/readme.txt @@ -187,7 +187,7 @@ if ($fp_remote = fopen($remotefilename, 'rb')) { // Initialize getID3 engine $getID3 = new getID3; - $ThisFileInfo = $getID3->analyze($filename); + $ThisFileInfo = $getID3->analyze($localtempfilename); // Delete temporary file unlink($localtempfilename); @@ -195,6 +195,11 @@ if ($fp_remote = fopen($remotefilename, 'rb')) { fclose($fp_remote); } +Note: since v1.9.9-20150212 it is possible a second and third parameter +to $getID3->analyze(), for original filesize and original filename +respectively. This permits you to download only a portion of a large remote +file but get accurate playtime estimates, assuming the format only requires +the beginning of the file for correct format analysis. See /demos/demo.write.php for how to write tags. @@ -432,6 +437,11 @@ Known Bugs/Issues in other programs ----------------------------------- http://www.getid3.org/phpBB3/viewtopic.php?t=25 +* MusicBrainz Picard (at least up to v1.3.2) writes multiple + ID3v2.3 genres in non-standard forward-slash separated text + rather than parenthesis-numeric+refinement style per the ID3v2.3 + specs. Tags written in ID3v2.4 mode are written correctly. + (detected and worked around by getID3()) * PZ TagEditor v4.53.408 has been known to insert ID3v2.3 frames into an existing ID3v2.2 tag which, of course, breaks things * Windows Media Player (up to v11) and iTunes (up to v10+) do @@ -604,3 +614,4 @@ Reference material: * http://trac.musepack.net/trac/wiki/SV8Specification * http://wyday.com/cuesharp/specification.php * http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Nikon.html +* http://www.codeproject.com/Articles/8295/MPEG-Audio-Frame-Header \ No newline at end of file diff --git a/app/Library/getid3/structure.txt b/app/Library/getid3/structure.txt old mode 100755 new mode 100644 From 91a4a2d660c10876ce4c9ccb5742b3b7e1194afe Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Sun, 20 Dec 2015 03:33:22 -0800 Subject: [PATCH 6/9] Patched getID3() for PHP 7. --- app/Library/getid3/getid3/extension.cache.dbm.php | 2 +- app/Library/getid3/getid3/extension.cache.mysql.php | 2 +- app/Library/getid3/getid3/module.tag.xmp.php | 2 +- app/Library/getid3/getid3/write.apetag.php | 2 +- app/Library/getid3/getid3/write.id3v1.php | 2 +- app/Library/getid3/getid3/write.id3v2.php | 2 +- app/Library/getid3/getid3/write.lyrics3.php | 2 +- app/Library/getid3/getid3/write.metaflac.php | 2 +- app/Library/getid3/getid3/write.php | 2 +- app/Library/getid3/getid3/write.real.php | 2 +- app/Library/getid3/getid3/write.vorbiscomment.php | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/Library/getid3/getid3/extension.cache.dbm.php b/app/Library/getid3/getid3/extension.cache.dbm.php index ada8d5bc..a9332b92 100644 --- a/app/Library/getid3/getid3/extension.cache.dbm.php +++ b/app/Library/getid3/getid3/extension.cache.dbm.php @@ -74,7 +74,7 @@ class getID3_cached_dbm extends getID3 { // public: constructor - see top of this file for cache type and cache_options - public function getID3_cached_dbm($cache_type, $dbm_filename, $lock_filename) { + public function __construct($cache_type, $dbm_filename, $lock_filename) { // Check for dba extension if (!extension_loaded('dba')) { diff --git a/app/Library/getid3/getid3/extension.cache.mysql.php b/app/Library/getid3/getid3/extension.cache.mysql.php index a94eb9d9..f4358211 100644 --- a/app/Library/getid3/getid3/extension.cache.mysql.php +++ b/app/Library/getid3/getid3/extension.cache.mysql.php @@ -80,7 +80,7 @@ class getID3_cached_mysql extends getID3 // public: constructor - see top of this file for cache type and cache_options - public function getID3_cached_mysql($host, $database, $username, $password, $table='getid3_cache') { + public function __construct($host, $database, $username, $password, $table='getid3_cache') { // Check for mysql support if (!function_exists('mysql_pconnect')) { diff --git a/app/Library/getid3/getid3/module.tag.xmp.php b/app/Library/getid3/getid3/module.tag.xmp.php index ea769876..40dd8bd8 100644 --- a/app/Library/getid3/getid3/module.tag.xmp.php +++ b/app/Library/getid3/getid3/module.tag.xmp.php @@ -399,7 +399,7 @@ class Image_XMP * * @param string - Name of the image file to access and extract XMP information from. */ - public function Image_XMP($sFilename) + public function __construct($sFilename) { $this->_sFilename = $sFilename; diff --git a/app/Library/getid3/getid3/write.apetag.php b/app/Library/getid3/getid3/write.apetag.php index f1f82bc4..d6044b29 100644 --- a/app/Library/getid3/getid3/write.apetag.php +++ b/app/Library/getid3/getid3/write.apetag.php @@ -26,7 +26,7 @@ class getid3_write_apetag public $warnings = array(); // any non-critical errors will be stored here public $errors = array(); // any critical errors will be stored here - public function getid3_write_apetag() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.id3v1.php b/app/Library/getid3/getid3/write.id3v1.php index 878f9902..4fa6a6c3 100644 --- a/app/Library/getid3/getid3/write.id3v1.php +++ b/app/Library/getid3/getid3/write.id3v1.php @@ -24,7 +24,7 @@ class getid3_write_id3v1 public $warnings = array(); // any non-critical errors will be stored here public $errors = array(); // any critical errors will be stored here - public function getid3_write_id3v1() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.id3v2.php b/app/Library/getid3/getid3/write.id3v2.php index 236e2ff4..d3fa84c4 100644 --- a/app/Library/getid3/getid3/write.id3v2.php +++ b/app/Library/getid3/getid3/write.id3v2.php @@ -30,7 +30,7 @@ class getid3_write_id3v2 public $warnings = array(); // any non-critical errors will be stored here public $errors = array(); // any critical errors will be stored here - public function getid3_write_id3v2() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.lyrics3.php b/app/Library/getid3/getid3/write.lyrics3.php index 6546c3eb..12275f49 100644 --- a/app/Library/getid3/getid3/write.lyrics3.php +++ b/app/Library/getid3/getid3/write.lyrics3.php @@ -23,7 +23,7 @@ class getid3_write_lyrics3 public $warnings = array(); // any non-critical errors will be stored here public $errors = array(); // any critical errors will be stored here - public function getid3_write_lyrics3() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.metaflac.php b/app/Library/getid3/getid3/write.metaflac.php index d7bee70a..186e2c17 100644 --- a/app/Library/getid3/getid3/write.metaflac.php +++ b/app/Library/getid3/getid3/write.metaflac.php @@ -23,7 +23,7 @@ class getid3_write_metaflac public $warnings = array(); // any non-critical errors will be stored here public $errors = array(); // any critical errors will be stored here - public function getid3_write_metaflac() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.php b/app/Library/getid3/getid3/write.php index 9a7ec519..ea136934 100644 --- a/app/Library/getid3/getid3/write.php +++ b/app/Library/getid3/getid3/write.php @@ -64,7 +64,7 @@ class getid3_writetags // private private $ThisFileInfo; // analysis of file before writing - public function getid3_writetags() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.real.php b/app/Library/getid3/getid3/write.real.php index 04210e04..fd67c859 100644 --- a/app/Library/getid3/getid3/write.real.php +++ b/app/Library/getid3/getid3/write.real.php @@ -23,7 +23,7 @@ class getid3_write_real public $errors = array(); // any critical errors will be stored here public $paddedlength = 512; // minimum length of CONT tag in bytes - public function getid3_write_real() { + public function __construct() { return true; } diff --git a/app/Library/getid3/getid3/write.vorbiscomment.php b/app/Library/getid3/getid3/write.vorbiscomment.php index 65f34b39..971f91fe 100644 --- a/app/Library/getid3/getid3/write.vorbiscomment.php +++ b/app/Library/getid3/getid3/write.vorbiscomment.php @@ -23,7 +23,7 @@ class getid3_write_vorbiscomment public $warnings = array(); // any non-critical errors will be stored here public $errors = array(); // any critical errors will be stored here - public function getid3_write_vorbiscomment() { + public function __construct() { return true; } From fe1133e99e405537667b039ad7283713ace35363 Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Sun, 20 Dec 2015 04:59:01 -0800 Subject: [PATCH 7/9] Removed non-local configs from this repo. --- .git-crypt/.gitattributes | 3 --- .../260F34CF197E4BAEC8FCB18D3F53E6CCAA9B0520.gpg | Bin 725 -> 0 bytes .../290DB155720C634A6B2FB8C6B0F6FDFF8C265086.gpg | Bin 725 -> 0 bytes .../E56903992FD8A1780E87A9B3B1EB127DB82FB666.gpg | Bin 725 -> 0 bytes .gitattributes | 3 --- resources/environments/.env.production | Bin 580 -> 0 bytes resources/environments/.env.stage | Bin 587 -> 0 bytes 7 files changed, 6 deletions(-) delete mode 100644 .git-crypt/.gitattributes delete mode 100644 .git-crypt/keys/default/0/260F34CF197E4BAEC8FCB18D3F53E6CCAA9B0520.gpg delete mode 100644 .git-crypt/keys/default/0/290DB155720C634A6B2FB8C6B0F6FDFF8C265086.gpg delete mode 100644 .git-crypt/keys/default/0/E56903992FD8A1780E87A9B3B1EB127DB82FB666.gpg delete mode 100644 resources/environments/.env.production delete mode 100644 resources/environments/.env.stage diff --git a/.git-crypt/.gitattributes b/.git-crypt/.gitattributes deleted file mode 100644 index 17ef6016..00000000 --- a/.git-crypt/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Do not edit this file. To specify the files to encrypt, create your own -# .gitattributes file in the directory where your files are. -* !filter !diff diff --git a/.git-crypt/keys/default/0/260F34CF197E4BAEC8FCB18D3F53E6CCAA9B0520.gpg b/.git-crypt/keys/default/0/260F34CF197E4BAEC8FCB18D3F53E6CCAA9B0520.gpg deleted file mode 100644 index cff3baa1f7dd818856f0be88e639bfb2974940f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 725 zcmV;`0xJE50t^G9ak;#dFlAr?5CE5J1FlB5L%c&kLGNwFqlGdptPrg@S2x?iG{`f1 zbg+y#x3EWHPdM(r#XJ-;zT9DyyZc-+#|0?To*dTyv}wsS?ovV`m2?+YNb0YeXG?W@ zUz+wC29*<%&q5$PIHbSLuqB+pSlBlY!}Blu*O7{FlEnvBeQ0UK9J?Tj4n9FtbQl?t zObRx+MXP6~QhgFYtAvy3&8Jiq-zMsp_!Z9z+n=ec)?<UJXxz7~#!g<zx1Vc{AVRTw zZtx1IEL^Ad#zF;&lyic5Y>n3%_HVXhJW;nFY`hW3a>m|+9jQNLmk0HZA;%X4LS+yZ zP(siacdvK>D+;D(XJ=N;pZaN>+XxW7S^JMn$D#mIMH;^T7CJ|bSU1shrSGz$Qbj`p znnd32U^L2IwG8B-iG$UvlLK<z5&dbd3fNr#pEIWLd$8FG6`6;VOsIw~=o1DYmp|&6 zN#I>=uKbQ^Z^8-Xf>jqaz^y9KUPxmCR{S#u5eVjlU`)$PLw10nY2(ytJSKNm?E!8u zLqSN^`w|H7EcBQHv9QnA3DXsHMoJ2!Ffik;%z6vL6iUg$`{P2bQ(uR*GzVxGq3&<6 z9}wr-FYDDB9@06Iy3DM`T*4gu(%r-Juz0f_N}iJP_E2;1dkd-JkqZ~E2)$_i*YIKA zJ=BvJ#$?@|#1S!Eji1uM0|7C#NXPK$;|el!-51507PhH&%s*5%TUO(ODYU_BEnpx% z5LR!rVV3B58|BJ2Fdt0RfF$Kn6G_4nQy@g9JOXOhkL0gycBzSb$3oeeC*c-L!rDf& z$(f9jar9za7+o%4U|aq9uFmZ@?RjinojNX#Qv)%{SL0USKiUv-%x1ZHY-ss+B4wFC z-U8R`_17FL8p&G_0(wwjtxb@Lgf{blk1zOVV9X9~Q<qUE`P5hEXuM>|cD)zLppg-K Hm0r*jSPEU# diff --git a/.git-crypt/keys/default/0/290DB155720C634A6B2FB8C6B0F6FDFF8C265086.gpg b/.git-crypt/keys/default/0/290DB155720C634A6B2FB8C6B0F6FDFF8C265086.gpg deleted file mode 100644 index 987b3c5accf03c7bee3f4109ea77fec66b31cbba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 725 zcmV;`0xJE50t^Gv7euw6h=1$>5B@Yu%u%c?*`{}zH>?FmH6>T#4n1wx^LFCht*RZ0 z`H&lW)}U+T;|U<c49f@d5QpXzU_)ac`z2V@m&%vtC*R7jnWm_~?bdj;4P6Wx&2<6( zt@cI>_t|z2W+`172SjiNdW#BYBpu3iKrSRT@Z-Fy<WV#E0x5Ta!X-5f{jX=_Mg3hA z&_My}+qjIdC%Y``FJE5sX}C~oPtOccdNhngW!*I|%dvpZMrG9wAUlM;eSi!kJ#?rc z#L+OQ=wBOGy=|JW=)xfzN$9IF?P&j2nFX2L0xWO{&7K^yMqLMJeN2l+*e`iasXyqm z>`&gSJ;8XsR87&q2W?%x8lnx(_8t0-sc*`nq=7bWJuruUvOa@i<r@CiC!!7&JNA^q zXj7rYc2gf^JMf@=xH+Je6q|jlE>RdkiCW*a!*0>3sO{x8U2{T250&{N;F{&)wB(dR zbq`yI`(aw@uneB8iqBmH;<QA>8tdIg7WXtc{a_vfsJ5frljzeIJ_QR;JO-QTRMp0V zRZJltw#w<>zJ5cyqS3Q0z&Df6Lu(Mnvp5<nou>l$F9`nCF=XGrWC)}0C3m-3@t4cu zTPgT}v1^3701a~dDY-Ja9~0NZ<GXM@jUbYKvh%-+XeR16|FF|0wBfIp+;KZJLHEJ0 z)Le=BWz-2SSimLy^Tg7?0|BUwmSic?$ZN)RGOGck2^Ax_NQpv7vLl~_znmuCk!@eI znAFI6%;FphvGvo##c2Xipq??q>V#7k9N9$HbI|5v)MQ&<^bB^`+wQH6@%l%p+2j}` z^ZH01w^d4ek#%@&bf7M_htr^v(A?KX0wHIF9351L@ZA_q(-hcA$yDYsK1o$<nVx2h zG?!yTD;LRQbZ1ra4-u*+RX;cI$Gte-K;)>0bH?}R&3sLZYWaLwRG#3zL*mi?QGE6! H5(j*T_lavF diff --git a/.git-crypt/keys/default/0/E56903992FD8A1780E87A9B3B1EB127DB82FB666.gpg b/.git-crypt/keys/default/0/E56903992FD8A1780E87A9B3B1EB127DB82FB666.gpg deleted file mode 100644 index 49d4d584ad260e3fdb74a8a2ccef79993ccc9e6e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 725 zcmV;`0xJE50t^H6S6h#Y!|OQ#5C3CpI3@+f8kj|ci$eHQX6=$aFn<CX#MFEs7Tqw% zLtue*wJ0`>@<$YhqIyG2J^dKTw(YP*le6PN)vNXUX^E4;a6xPx)<}d7k3V|>O@{F` z#thu*$TI#cZ_MQDi!B@fxtWqDCC1v(rjCh4e*pszoW@<%8gOf9+Ky_&hML9nh8j8y zK)|h0S}u5DJcg%u(oNDlt?OJwsBVov?w?Jwkw7=04pT=}g{g~M;jgls(O>DmDGl!H zw2Iq)jan9*){80K&mb{J(8`(A09*Z5deb|bn>T5b{w1mZ525rYu%iTqkOqe>vi#0W z><XI>AoIN1&5c|iJ^&h5j7#|_4ib)QZ)~Go&!rh6pP0$}y9ZWwJqwPMn4lmf2>oV> z%xDg2FQG6G{1#Q9ou9rcz5NK)UW=SN?l(9&M;QiP5BwYGW4HqVo>BMK%Zcw4;~A`k zsrh4LyN(wS0q?npWqAtkrGYC}1w;a0MtBl+hTbaGl1mcANO9@)(^rksekKuvHxRf6 znkZemL{|*eHI0?pMoQi@rgcZq5ooY_eAimOl%o1h_G$IUy)Q$zAyP%APMOg*LzgF| z$bAlX0aI5Vwl13cjn^E$zgEyC7_#vU5%n$c7fsb0f3HnN!PyEkFeMj30VYWceneI) znj=cVe2^C#aX-50>nYN}0|C|oxWKx&Nds7<P2}(w%f%HGbJR}FD!~DuyOsi^3`r1R zdTv*kQitpK*N8kGH1+*OI!F0}t#CrtHd_#-hVV?b_ouyR=A+pG;Ak(&r4w>~!2B>c zV})rhR#h3Sg#Dmuf&ZH??JAJruQ@9^^Y&vX;z#s-!HCa^h98C^GHd1rWY~Sw%Zl5N z#z80~Bet0z)O`XAZaVlvXO9#)y_G|%^7o4{5-LebYiFYsTWsm=Gp3J1fnGx1q#P&s HTQQjE$;eq! diff --git a/.gitattributes b/.gitattributes index 011b6259..83a9ffb8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,4 @@ * text=auto -resources/environments/.env.stage filter=git-crypt diff=git-crypt -resources/environments/.env.production filter=git-crypt diff=git-crypt - *.css linguist-vendored *.less linguist-vendored diff --git a/resources/environments/.env.production b/resources/environments/.env.production deleted file mode 100644 index 2d9a778d360fed6315916c37d45bd5e25a24e78d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 580 zcmV-K0=xYHM@dveQdv+`0LzACBE<TfzZic$NszqXS|ey-#)C%N+9H38u+GCJGd)%C zN`Q4M-%OJ)1_Glfqt3p2|40g$EwzyG(Ic(Na=K!G7$&{0UP?nExTxdFWkaZNq_~!m z76x=<SbqLdhl)}v6t#V_pZ(_&08Eq#RsA+cnRR)4;@$}i@XO$-$ppKN7LrSgNIw>M zcYo-j$)y81u5^6ObkYQ*iavQtp4ljsFcs!}BEirQ%Gt17I#kat%r4f_4=W#P7xQ;> zDjiaUPeUok*R>2;FJhm<r9?w~3xggf4?a~ve_TUDV#ec#@LdZ=W6XayWLNk)LK)9B zbb6K1GC(NZ9-^kla_FJZz1I@!bNz$P%nA&YnuCvM&@RC6nG^nE8_D+<t~;=Zyn!Wa z?I)h^m;b*chqB{XE5}5&F^y%8{|c`TnR8);rP(i%_9InhP+y}Ej51^ITn>eaG~lfK zIy+{we4G`^h0n8a*J?gR?}eEFMohe<)dZcx;8D@=w4sI_nB;e*4zw92FSGaB;1NiT zY&(Ji1m9K1kFm{;9Y<pXaS4O8o}RKdrZ%A^a3r8*p71>lPnfkYR}0U&G0fr7C@z4t z{a>a2!w(@HC(;?(myD;+bFf+IC9OOTG0*@7=Z4mH2Dw;gVrf{DwnUu+%$Vtv5t?`; z6rXf(DAf7!hEd#TN5**ZVi&l!PqS(lf|F|O5^{N@QCrX!waHB`{!zl`LyXPHNPg@6 S!Gnvr>IIm)W7XH<fkj_j@fxlG diff --git a/resources/environments/.env.stage b/resources/environments/.env.stage deleted file mode 100644 index 1646235553d4261015cd2e792fb7dd0fb996f9aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 587 zcmV-R0<`@AM@dveQdv+`0Ft23JENoJ$lvr!eUkz&8?8mV8r%z&-VNf8Pq4GJd_$X4 z$u6Y}GA>-=Co%F5Qj_GyOy#1m8#I_Q4-q11LvgC<%7*$|<YjmhVbM%Ec^W*mTZaEQ z?8C`kX2y9Oj+mMmw5lTRYt`jp1_S^;aEX<{zxUI5@e~|vUlXC3_~65WY`RS_SW22t zY%(ohUWN!ejviz|8FMf6xyP}oXf|DMYiBAI?7ji@wx|~7<;mLes6m{WgclN`%6Mfg z9npBR<vtn_CViK!lcVlA9(R9Ui&%PsgWH(WibiHlT&D*}T`bI_b&h9fZ=ps6X%O-o z*@{zCZy)FvxS69&#zDObp|f+R9msebb(*htTK9m`$U4+I@6GV%WdFiI#z)xYVL#zZ zF_bRG8@+WNIxX%<(44)|g;F42!G6gXg3;%SFmh3UVB{yEPs;fvYXvgLNJ8m5Z{f|o z+isF1QSIhjk5S$_-hUEun$qs5EpfxQ={jP3UdQ4PXL{(B9Oa<s?i3b59^c~yl~}b^ z;)US*N`L(x^U38F++FYl4{Z;Z?dIo>Tsv)RX#Y2X{%I8C6{ZF}p70kklZODcr*kx@ zMMOBed-YdQYe4oy#&W()%Rn3{mvhpm<tN|u0zo4=KnWN@yZKtnYWoPX%!lHdq~O^L zRA_F(1Lb+7KSDPp_tET=;A6iMl9h3=Wf{#${i>CbQ6gsj5mhlhvZs=_Qfv2O3)e`d ZteWP$oEr6uT8dbX`-Rb6*i;3VCIq+~BP;*_ From e6c31a1500118899b1afb53795ae50565d858af3 Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Sun, 20 Dec 2015 07:07:36 -0800 Subject: [PATCH 8/9] Updated URL generation to use Laravel 5's helpers. --- app/Album.php | 7 ++-- app/Genre.php | 3 +- app/Http/Controllers/AuthController.php | 5 ++- app/Http/Controllers/ImagesController.php | 3 +- app/Http/Controllers/UsersController.php | 44 ----------------------- app/Http/routes.php | 2 -- app/Image.php | 5 ++- app/Playlist.php | 7 ++-- app/Providers/AppServiceProvider.php | 10 ------ app/Track.php | 11 +++--- app/TrackFile.php | 3 +- app/User.php | 13 +------ 12 files changed, 19 insertions(+), 94 deletions(-) delete mode 100644 app/Http/Controllers/UsersController.php diff --git a/app/Album.php b/app/Album.php index f1c8c11d..abe43872 100644 --- a/app/Album.php +++ b/app/Album.php @@ -28,7 +28,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs; use Auth; use Cache; use Poniverse\Ponyfm\Traits\TrackCollection; -use URL; use Poniverse\Ponyfm\Traits\SlugTrait; use Venturecraft\Revisionable\RevisionableTrait; @@ -131,7 +130,7 @@ class Album extends Model $data['description'] = $album->description; $data['is_downloadable'] = $is_downloadable; $data['share'] = [ - 'url' => URL::to('/a' . $album->id), + 'url' => action('AlbumsController@getShortlink', ['id' => $album->id]), 'tumblrUrl' => 'http://www.tumblr.com/share/link?url=' . urlencode($album->url) . '&name=' . urlencode($album->title) . '&description=' . urlencode($album->description), 'twitterUrl' => 'https://platform.twitter.com/widgets/tweet_button.html?text=' . $album->title . ' by ' . $album->user->display_name . ' on Pony.fm' ]; @@ -198,12 +197,12 @@ class Album extends Model public function getUrlAttribute() { - return URL::to('albums/' . $this->id . '-' . $this->slug); + return action('AlbumsController@getShow', ['id' => $this->id, 'slug' => $this->slug]); } public function getDownloadUrl($format) { - return URL::to('a' . $this->id . '/dl.' . Track::$Formats[$format]['extension']); + return action('AlbumsController@getDownload', ['id' => $this->id, 'extension' => Track::$Formats[$format]['extension']]); } public function getFilesize($format) diff --git a/app/Genre.php b/app/Genre.php index f44d5c71..529352b3 100644 --- a/app/Genre.php +++ b/app/Genre.php @@ -25,7 +25,6 @@ use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\SoftDeletes; use Poniverse\Ponyfm\Traits\SlugTrait; use Illuminate\Database\Eloquent\Model; -use URL; use Venturecraft\Revisionable\RevisionableTrait; class Genre extends Model @@ -75,6 +74,6 @@ class Genre extends Model * @return string relative, Angular-friendly URL to this genre */ public function getUrlAttribute() { - return URL::route('tracks.discover', ['filter' => "genres-{$this->id}"], false); + return route('tracks.discover', ['filter' => "genres-{$this->id}"], false); } } diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 5d8b7c32..53bf1bb3 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -27,7 +27,6 @@ use DB; use Input; use Poniverse; use Redirect; -use URL; class AuthController extends Controller { @@ -36,7 +35,7 @@ class AuthController extends Controller public function __construct() { $this->poniverse = new Poniverse(Config::get('poniverse.client_id'), Config::get('poniverse.secret')); - $this->poniverse->setRedirectUri(URL::to('/auth/oauth')); + $this->poniverse->setRedirectUri(action('AuthController@getOAuth')); } public function getLogin() @@ -62,7 +61,7 @@ class AuthController extends Controller 'authorization_code', [ 'code' => Input::query('code'), - 'redirect_uri' => URL::to('/auth/oauth') + 'redirect_uri' => action('AuthController@getOAuth') ]); if ($code['code'] != 200) { diff --git a/app/Http/Controllers/ImagesController.php b/app/Http/Controllers/ImagesController.php index 384e0b52..f6cbc515 100644 --- a/app/Http/Controllers/ImagesController.php +++ b/app/Http/Controllers/ImagesController.php @@ -25,7 +25,6 @@ use Config; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Redirect; use Response; -use URL; class ImagesController extends Controller { @@ -46,7 +45,7 @@ class ImagesController extends Controller $filename = $image->getFile($coverType['id']); if (!is_file($filename)) { - $redirect = URL::to('/images/icons/profile_' . Image::$ImageTypes[$coverType['id']]['name'] . '.png'); + $redirect = url('/images/icons/profile_' . Image::$ImageTypes[$coverType['id']]['name'] . '.png'); return Redirect::to($redirect); } diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php deleted file mode 100644 index 0484641a..00000000 --- a/app/Http/Controllers/UsersController.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -/** - * Pony.fm - A community for pony fan music. - * Copyright (C) 2015 Peter Deltchev - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -namespace Poniverse\Ponyfm\Http\Controllers; - -use Poniverse\Ponyfm\User; -use File; -use Illuminate\Support\Facades\App; - -class UsersController extends Controller -{ - public function getAvatar($id, $type) - { - $coverType = Cover::getCoverFromName($type); - - if ($coverType == null) { - App::abort(404); - } - - $user = User::find($id); - if (!$user) { - App::abort(404); - } - - return File::inline($user->getAvatarFile($coverType['id']), 'image/png', 'cover.png'); - } -} diff --git a/app/Http/routes.php b/app/Http/routes.php index afa12b27..1dc8b931 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -62,8 +62,6 @@ Route::get('/mlpforums-advertising-program', function() { return View::make('pag Route::get('i{id}/{type}.png', 'ImagesController@getImage')->where('id', '\d+'); -Route::get('u{id}/avatar_{type}.png', 'UsersController@getAvatar')->where('id', '\d+'); - Route::get('playlist/{id}-{slug}', 'PlaylistsController@getPlaylist'); Route::get('p{id}', 'PlaylistsController@getShortlink')->where('id', '\d+'); Route::get('p{id}/dl.{extension}', 'PlaylistsController@getDownload' ); diff --git a/app/Image.php b/app/Image.php index bc7829d9..c888ff79 100644 --- a/app/Image.php +++ b/app/Image.php @@ -22,8 +22,7 @@ namespace Poniverse\Ponyfm; use External; use Illuminate\Database\Eloquent\Model; -use Illuminate\Support\Facades\Config; -use Illuminate\Support\Facades\URL; +use Config; use Symfony\Component\HttpFoundation\File\UploadedFile; class Image extends Model @@ -101,7 +100,7 @@ class Image extends Model { $type = self::$ImageTypes[$type]; - return URL::to('i' . $this->id . '/' . $type['name'] . '.png'); + return action('ImagesController@getImage', ['id' => $this->id, 'type' => $type['name']]); } public function getFile($type = self::NORMAL) diff --git a/app/Playlist.php b/app/Playlist.php index 042249e2..e9deaf61 100644 --- a/app/Playlist.php +++ b/app/Playlist.php @@ -27,7 +27,6 @@ use Illuminate\Foundation\Bus\DispatchesJobs; use Auth; use Cache; use Poniverse\Ponyfm\Traits\TrackCollection; -use URL; use Poniverse\Ponyfm\Traits\SlugTrait; use Venturecraft\Revisionable\RevisionableTrait; @@ -88,7 +87,7 @@ class Playlist extends Model $data['comments'] = $comments; $data['formats'] = $formats; $data['share'] = [ - 'url' => URL::to('/p' . $playlist->id), + 'url' => action('PlaylistsController@getShortlink', ['id' => $playlist->id]), 'tumblrUrl' => 'http://www.tumblr.com/share/link?url=' . urlencode($playlist->url) . '&name=' . urlencode($playlist->title) . '&description=' . urlencode($playlist->description), 'twitterUrl' => 'https://platform.twitter.com/widgets/tweet_button.html?text=' . $playlist->title . ' by ' . $playlist->user->display_name . ' on Pony.fm' ]; @@ -202,12 +201,12 @@ class Playlist extends Model public function getUrlAttribute() { - return URL::to('/playlist/' . $this->id . '-' . $this->slug); + return action('PlaylistsController@getPlaylist', ['id' => $this->id, 'slug' => $this->slug]); } public function getDownloadUrl($format) { - return URL::to('p' . $this->id . '/dl.' . Track::$Formats[$format]['extension']); + return action('PlaylistsController@getDownload', ['id' => $this->id]); } public function getFilesize($format) diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index b0e2ff1e..dfaf53db 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -20,11 +20,7 @@ namespace Poniverse\Ponyfm\Providers; -use App; -use Auth; -use Illuminate\Auth\Guard; use Illuminate\Support\ServiceProvider; -// use PFMAuth; use PfmValidator; use Validator; @@ -37,12 +33,6 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { -/* - Auth::extend('pfm', function() { - return new Guard(new PFMAuth(), App::make('session.store')); - }); -*/ - Validator::resolver(function($translator, $data, $rules, $messages) { return new PfmValidator($translator, $data, $rules, $messages); diff --git a/app/Track.php b/app/Track.php index 2882db92..d5b005b6 100644 --- a/app/Track.php +++ b/app/Track.php @@ -33,7 +33,6 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Str; use Log; -use URL; use Venturecraft\Revisionable\RevisionableTrait; class Track extends Model @@ -257,8 +256,8 @@ class Track extends Model } $returnValue['share'] = [ - 'url' => URL::to('/t' . $track->id), - 'html' => '<iframe src="' . URL::to('t' . $track->id . '/embed') . '" width="100%" height="150" allowTransparency="true" frameborder="0" seamless allowfullscreen></iframe>', + 'url' => action('TracksController@getShortlink', ['id' => $track->id]), + 'html' => '<iframe src="' . action('TracksController@getEmbed', ['id' => $track->id]) . '" width="100%" height="150" allowTransparency="true" frameborder="0" seamless allowfullscreen></iframe>', 'bbcode' => '[url=' . $track->url . '][img]' . $track->getCoverUrl() . '[/img][/url]', 'twitterUrl' => 'https://platform.twitter.com/widgets/tweet_button.html?text=' . $track->title . ' by ' . $track->user->display_name . ' on Pony.fm' ]; @@ -477,7 +476,7 @@ class Track extends Model public function getUrlAttribute() { - return URL::to('/tracks/' . $this->id . '-' . $this->slug); + return action('TracksController@getTrack', ['id' => $this->id, 'slug' => $this->slug]); } public function getDownloadDirectoryAttribute() @@ -537,7 +536,7 @@ class Track extends Model public function getStreamUrl($format = 'MP3') { - return URL::to('/t' . $this->id . '/stream.' . self::$Formats[$format]['extension']); + return action('TracksController@getStream', ['id' => $this->id, 'extension' => self::$Formats[$format]['extension']]); } public function getDirectory() @@ -605,7 +604,7 @@ class Track extends Model $format = self::$Formats[$format]; - return URL::to('/t' . $this->id . '/dl.' . $format['extension']); + return action('TracksController@getDownload', ['id' => $this->id, 'extension' => $format['extension']]); } diff --git a/app/TrackFile.php b/app/TrackFile.php index 22e9d779..a705c998 100644 --- a/app/TrackFile.php +++ b/app/TrackFile.php @@ -25,7 +25,6 @@ use Helpers; use Illuminate\Database\Eloquent\Model; use App; use File; -use URL; class TrackFile extends Model { @@ -88,7 +87,7 @@ class TrackFile extends Model public function getUrlAttribute() { - return URL::to('/t' . $this->track_id . '/dl.' . $this->extension); + return action('TracksController@getDownload', ['id' => $this->track_id, 'extension' => $this->extension]); } public function getSizeAttribute() diff --git a/app/User.php b/app/User.php index 6062154e..071d7cce 100644 --- a/app/User.php +++ b/app/User.php @@ -85,7 +85,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon public function getUrlAttribute() { - return URL::to('/' . $this->slug); + return action('ArtistsController@getProfile', $this->slug); } public function getMessageUrlAttribute() @@ -133,17 +133,6 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon return Gravatar::getUrl($email, Image::$ImageTypes[$type]['width']); } - public function getAvatarFile($type = Image::NORMAL) - { - if ($this->uses_gravatar) { - throw new Exception('Cannot get avatar file if this user is configured to use Gravatar!'); - } - - $imageType = Image::$ImageTypes[$type]; - - return URL::to('t' . $this->id . '/cover_' . $imageType['name'] . '.png?' . $this->cover_id); - } - /** * Get the token value for the "remember me" session. * From f3f478cca43e56a8e69a1463c3ef7cb636de328d Mon Sep 17 00:00:00 2001 From: Peter Deltchev <peter@deltchev.com> Date: Sun, 20 Dec 2015 10:30:51 -0800 Subject: [PATCH 9/9] Upgraded the dev environment to PHP 7. --- Vagrantfile | 4 +- ...2013_09_10_014644_create_latest_column.php | 32 +- vagrant/copy-and-restart-configs.sh | 9 +- vagrant/php-overrides.ini | 5 + vagrant/php.ini | 1953 ----------------- vagrant/pony.fm.mysql.config | 127 -- vagrant/pony.fm.nginx.config | 114 +- vagrant/pony.fm.nginx.site.config | 67 +- 8 files changed, 108 insertions(+), 2203 deletions(-) create mode 100644 vagrant/php-overrides.ini delete mode 100644 vagrant/php.ini delete mode 100644 vagrant/pony.fm.mysql.config diff --git a/Vagrantfile b/Vagrantfile index 95fd21ad..910a192f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -3,8 +3,8 @@ Vagrant.configure("2") do |config| config.hostmanager.enabled = true config.hostmanager.manage_host = true - config.vm.box = 'laravel/homestead' - config.vm.box_version = '0.3.0' + config.vm.box = 'laravel/homestead-7' + config.vm.box_version = '0.2.0' config.vm.provider "virtualbox" do |v| v.cpus = 4 v.memory = 2048 diff --git a/database/migrations/2013_09_10_014644_create_latest_column.php b/database/migrations/2013_09_10_014644_create_latest_column.php index c1f9b3d3..e87ec772 100644 --- a/database/migrations/2013_09_10_014644_create_latest_column.php +++ b/database/migrations/2013_09_10_014644_create_latest_column.php @@ -29,24 +29,20 @@ class CreateLatestColumn extends Migration }); DB::update(' - UPDATE - tracks - SET - is_latest = true - WHERE - ( - SELECT - t2.id - FROM - (SELECT id, user_id FROM tracks WHERE published_at IS NOT NULL AND deleted_at IS NULL) AS t2 - WHERE - t2.user_id = tracks.user_id - ORDER BY - created_at DESC - LIMIT 1 - ) = tracks.id - AND - published_at IS NOT NULL'); + UPDATE tracks t1 + INNER JOIN ( + SELECT id, user_id + FROM tracks + WHERE published_at IS NOT NULL + AND deleted_at IS NULL + ORDER BY created_at DESC + LIMIT 1 + ) t2 + ON t2.id = t1.id + SET is_latest = true + WHERE t2.user_id = t1.user_id + AND published_at IS NOT NULL + '); } public function down() diff --git a/vagrant/copy-and-restart-configs.sh b/vagrant/copy-and-restart-configs.sh index 64ebf08a..20a70c40 100755 --- a/vagrant/copy-and-restart-configs.sh +++ b/vagrant/copy-and-restart-configs.sh @@ -1,16 +1,13 @@ #!/usr/bin/env bash + sudo cp /vagrant/vagrant/pony.fm.nginx.config /etc/nginx/nginx.conf sudo cp /vagrant/vagrant/pony.fm.nginx.site.config /etc/nginx/sites-enabled/pony.fm -sudo cp /vagrant/vagrant/php.ini /etc/php5/fpm/php.ini - -sudo cp /vagrant/vagrant/pony.fm.mysql.config /etc/mysql/my.cnf +sudo cp /vagrant/vagrant/php-overrides.ini /etc/php/7.0/fpm/99-overrides.ini sudo cp /vagrant/vagrant/pony.fm.redis.config /etc/redis/redis.conf sudo service nginx restart -sudo service php5-fpm restart - -sudo service mysql restart +sudo service php7.0-fpm restart # todo: figure out how to restart redis diff --git a/vagrant/php-overrides.ini b/vagrant/php-overrides.ini new file mode 100644 index 00000000..b2c1457d --- /dev/null +++ b/vagrant/php-overrides.ini @@ -0,0 +1,5 @@ +[PHP] + +expose_php = Off +post_max_size = 250M +upload_max_filesize = 200M diff --git a/vagrant/php.ini b/vagrant/php.ini deleted file mode 100644 index 8d822965..00000000 --- a/vagrant/php.ini +++ /dev/null @@ -1,1953 +0,0 @@ -[PHP] - -;;;;;;;;;;;;;;;;;;; -; About php.ini ; -;;;;;;;;;;;;;;;;;;; -; PHP's initialization file, generally called php.ini, is responsible for -; configuring many of the aspects of PHP's behavior. - -; PHP attempts to find and load this configuration from a number of locations. -; The following is a summary of its search order: -; 1. SAPI module specific location. -; 2. The PHPRC environment variable. (As of PHP 5.2.0) -; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) -; 4. Current working directory (except CLI) -; 5. The web server's directory (for SAPI modules), or directory of PHP -; (otherwise in Windows) -; 6. The directory from the --with-config-file-path compile time option, or the -; Windows directory (C:\windows or C:\winnt) -; See the PHP docs for more specific information. -; http://php.net/configuration.file - -; The syntax of the file is extremely simple. Whitespace and lines -; beginning with a semicolon are silently ignored (as you probably guessed). -; Section headers (e.g. [Foo]) are also silently ignored, even though -; they might mean something in the future. - -; Directives following the section heading [PATH=/www/mysite] only -; apply to PHP files in the /www/mysite directory. Directives -; following the section heading [HOST=www.example.com] only apply to -; PHP files served from www.example.com. Directives set in these -; special sections cannot be overridden by user-defined INI files or -; at runtime. Currently, [PATH=] and [HOST=] sections only work under -; CGI/FastCGI. -; http://php.net/ini.sections - -; Directives are specified using the following syntax: -; directive = value -; Directive names are *case sensitive* - foo=bar is different from FOO=bar. -; Directives are variables used to configure PHP or PHP extensions. -; There is no name validation. If PHP can't find an expected -; directive because it is not set or is mistyped, a default value will be used. - -; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one -; of the INI constants (On, Off, True, False, Yes, No and None) or an expression -; (e.g. E_ALL & ~E_NOTICE), a quoted string ("bar"), or a reference to a -; previously set variable or directive (e.g. ${foo}) - -; Expressions in the INI file are limited to bitwise operators and parentheses: -; | bitwise OR -; ^ bitwise XOR -; & bitwise AND -; ~ bitwise NOT -; ! boolean NOT - -; Boolean flags can be turned on using the values 1, On, True or Yes. -; They can be turned off using the values 0, Off, False or No. - -; An empty string can be denoted by simply not writing anything after the equal -; sign, or by using the None keyword: - -; foo = ; sets foo to an empty string -; foo = None ; sets foo to an empty string -; foo = "None" ; sets foo to the string 'None' - -; If you use constants in your value, and these constants belong to a -; dynamically loaded extension (either a PHP extension or a Zend extension), -; you may only use these constants *after* the line that loads the extension. - -;;;;;;;;;;;;;;;;;;; -; About this file ; -;;;;;;;;;;;;;;;;;;; -; PHP comes packaged with two INI files. One that is recommended to be used -; in production environments and one that is recommended to be used in -; development environments. - -; php.ini-production contains settings which hold security, performance and -; best practices at its core. But please be aware, these settings may break -; compatibility with older or less security conscience applications. We -; recommending using the production ini in production and testing environments. - -; php.ini-development is very similar to its production variant, except it is -; much more verbose when it comes to errors. We recommend using the -; development version only in development environments, as errors shown to -; application users can inadvertently leak otherwise secure information. - -; This is php.ini-production INI file. - -;;;;;;;;;;;;;;;;;;; -; Quick Reference ; -;;;;;;;;;;;;;;;;;;; -; The following are all the settings which are different in either the production -; or development versions of the INIs with respect to PHP's default behavior. -; Please see the actual settings later in the document for more details as to why -; we recommend these changes in PHP's behavior. - -; display_errors -; Default Value: On -; Development Value: On -; Production Value: Off - -; display_startup_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; error_reporting -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT - -; html_errors -; Default Value: On -; Development Value: On -; Production value: On - -; log_errors -; Default Value: Off -; Development Value: On -; Production Value: On - -; max_input_time -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) - -; output_buffering -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 - -; register_argc_argv -; Default Value: On -; Development Value: Off -; Production Value: Off - -; request_order -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" - -; session.gc_divisor -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 - -; session.hash_bits_per_character -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 - -; short_open_tag -; Default Value: On -; Development Value: Off -; Production Value: Off - -; track_errors -; Default Value: Off -; Development Value: On -; Production Value: Off - -; url_rewriter.tags -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" - -; variables_order -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS" - -;;;;;;;;;;;;;;;;;;;; -; php.ini Options ; -;;;;;;;;;;;;;;;;;;;; -; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini" -;user_ini.filename = ".user.ini" - -; To disable this feature set this option to empty value -;user_ini.filename = - -; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes) -;user_ini.cache_ttl = 300 - -;;;;;;;;;;;;;;;;;;;; -; Language Options ; -;;;;;;;;;;;;;;;;;;;; - -; Enable the PHP scripting language engine under Apache. -; http://php.net/engine -engine = On - -; This directive determines whether or not PHP will recognize code between -; <? and ?> tags as PHP source which should be processed as such. It is -; generally recommended that <?php and ?> should be used and that this feature -; should be disabled, as enabling it may result in issues when generating XML -; documents, however this remains supported for backward compatibility reasons. -; Note that this directive does not control the <?= shorthand tag, which can be -; used regardless of this directive. -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/short-open-tag -short_open_tag = Off - -; Allow ASP-style <% %> tags. -; http://php.net/asp-tags -asp_tags = Off - -; The number of significant digits displayed in floating point numbers. -; http://php.net/precision -precision = 14 - -; Output buffering is a mechanism for controlling how much output data -; (excluding headers and cookies) PHP should keep internally before pushing that -; data to the client. If your application's output exceeds this setting, PHP -; will send that data in chunks of roughly the size you specify. -; Turning on this setting and managing its maximum buffer size can yield some -; interesting side-effects depending on your application and web server. -; You may be able to send headers and cookies after you've already sent output -; through print or echo. You also may see performance benefits if your server is -; emitting less packets due to buffered output versus PHP streaming the output -; as it gets it. On production servers, 4096 bytes is a good setting for performance -; reasons. -; Note: Output buffering can also be controlled via Output Buffering Control -; functions. -; Possible Values: -; On = Enabled and buffer is unlimited. (Use with caution) -; Off = Disabled -; Integer = Enables the buffer and sets its maximum size in bytes. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: Off -; Development Value: 4096 -; Production Value: 4096 -; http://php.net/output-buffering -output_buffering = 4096 - -; You can redirect all of the output of your scripts to a function. For -; example, if you set output_handler to "mb_output_handler", character -; encoding will be transparently converted to the specified encoding. -; Setting any output handler automatically turns on output buffering. -; Note: People who wrote portable scripts should not depend on this ini -; directive. Instead, explicitly set the output handler using ob_start(). -; Using this ini directive may cause problems unless you know what script -; is doing. -; Note: You cannot use both "mb_output_handler" with "ob_iconv_handler" -; and you cannot use both "ob_gzhandler" and "zlib.output_compression". -; Note: output_handler must be empty if this is set 'On' !!!! -; Instead you must use zlib.output_handler. -; http://php.net/output-handler -;output_handler = - -; Transparent output compression using the zlib library -; Valid values for this option are 'off', 'on', or a specific buffer size -; to be used for compression (default is 4KB) -; Note: Resulting chunk size may vary due to nature of compression. PHP -; outputs chunks that are few hundreds bytes each as a result of -; compression. If you prefer a larger chunk size for better -; performance, enable output_buffering in addition. -; Note: You need to use zlib.output_handler instead of the standard -; output_handler, or otherwise the output will be corrupted. -; http://php.net/zlib.output-compression -zlib.output_compression = Off - -; http://php.net/zlib.output-compression-level -;zlib.output_compression_level = -1 - -; You cannot specify additional output handlers if zlib.output_compression -; is activated here. This setting does the same as output_handler but in -; a different order. -; http://php.net/zlib.output-handler -;zlib.output_handler = - -; Implicit flush tells PHP to tell the output layer to flush itself -; automatically after every output block. This is equivalent to calling the -; PHP function flush() after each and every call to print() or echo() and each -; and every HTML block. Turning this option on has serious performance -; implications and is generally recommended for debugging purposes only. -; http://php.net/implicit-flush -; Note: This directive is hardcoded to On for the CLI SAPI -implicit_flush = Off - -; The unserialize callback function will be called (with the undefined class' -; name as parameter), if the unserializer finds an undefined class -; which should be instantiated. A warning appears if the specified function is -; not defined, or if the function doesn't include/implement the missing class. -; So only set this entry, if you really want to implement such a -; callback-function. -unserialize_callback_func = - -; When floats & doubles are serialized store serialize_precision significant -; digits after the floating point. The default value ensures that when floats -; are decoded with unserialize, the data will remain the same. -serialize_precision = 17 - -; open_basedir, if set, limits all file operations to the defined directory -; and below. This directive makes most sense if used in a per-directory -; or per-virtualhost web server configuration file. -; http://php.net/open-basedir -;open_basedir = - -; This directive allows you to disable certain functions for security reasons. -; It receives a comma-delimited list of function names. -; http://php.net/disable-functions -disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, - -; This directive allows you to disable certain classes for security reasons. -; It receives a comma-delimited list of class names. -; http://php.net/disable-classes -disable_classes = - -; Colors for Syntax Highlighting mode. Anything that's acceptable in -; <span style="color: ???????"> would work. -; http://php.net/syntax-highlighting -;highlight.string = #DD0000 -;highlight.comment = #FF9900 -;highlight.keyword = #007700 -;highlight.default = #0000BB -;highlight.html = #000000 - -; If enabled, the request will be allowed to complete even if the user aborts -; the request. Consider enabling it if executing long requests, which may end up -; being interrupted by the user or a browser timing out. PHP's default behavior -; is to disable this feature. -; http://php.net/ignore-user-abort -;ignore_user_abort = On - -; Determines the size of the realpath cache to be used by PHP. This value should -; be increased on systems where PHP opens many files to reflect the quantity of -; the file operations performed. -; http://php.net/realpath-cache-size -;realpath_cache_size = 16k - -; Duration of time, in seconds for which to cache realpath information for a given -; file or directory. For systems with rarely changing files, consider increasing this -; value. -; http://php.net/realpath-cache-ttl -;realpath_cache_ttl = 120 - -; Enables or disables the circular reference collector. -; http://php.net/zend.enable-gc -zend.enable_gc = On - -; If enabled, scripts may be written in encodings that are incompatible with -; the scanner. CP936, Big5, CP949 and Shift_JIS are the examples of such -; encodings. To use this feature, mbstring extension must be enabled. -; Default: Off -;zend.multibyte = Off - -; Allows to set the default encoding for the scripts. This value will be used -; unless "declare(encoding=...)" directive appears at the top of the script. -; Only affects if zend.multibyte is set. -; Default: "" -;zend.script_encoding = - -;;;;;;;;;;;;;;;;; -; Miscellaneous ; -;;;;;;;;;;;;;;;;; - -; Decides whether PHP may expose the fact that it is installed on the server -; (e.g. by adding its signature to the Web server header). It is no security -; threat in any way, but it makes it possible to determine whether you use PHP -; on your server or not. -; http://php.net/expose-php -expose_php = Off - -;;;;;;;;;;;;;;;;;;; -; Resource Limits ; -;;;;;;;;;;;;;;;;;;; - -; Maximum execution time of each script, in seconds -; http://php.net/max-execution-time -; Note: This directive is hardcoded to 0 for the CLI SAPI -max_execution_time = 30 - -; Maximum amount of time each script may spend parsing request data. It's a good -; idea to limit this time on productions servers in order to eliminate unexpectedly -; long running scripts. -; Note: This directive is hardcoded to -1 for the CLI SAPI -; Default Value: -1 (Unlimited) -; Development Value: 60 (60 seconds) -; Production Value: 60 (60 seconds) -; http://php.net/max-input-time -max_input_time = 60 - -; Maximum input variable nesting level -; http://php.net/max-input-nesting-level -;max_input_nesting_level = 64 - -; How many GET/POST/COOKIE input variables may be accepted -; max_input_vars = 1000 - -; Maximum amount of memory a script may consume (128MB) -; http://php.net/memory-limit -memory_limit = 512M - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Error handling and logging ; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -; This directive informs PHP of which errors, warnings and notices you would like -; it to take action for. The recommended way of setting values for this -; directive is through the use of the error level constants and bitwise -; operators. The error level constants are below here for convenience as well as -; some common settings and their meanings. -; By default, PHP is set to take action on all errors, notices and warnings EXCEPT -; those related to E_NOTICE and E_STRICT, which together cover best practices and -; recommended coding standards in PHP. For performance reasons, this is the -; recommend error reporting setting. Your production server shouldn't be wasting -; resources complaining about best practices and coding standards. That's what -; development servers and development settings are for. -; Note: The php.ini-development file has this setting as E_ALL. This -; means it pretty much reports everything which is exactly what you want during -; development and early testing. -; -; Error Level Constants: -; E_ALL - All errors and warnings (includes E_STRICT as of PHP 5.4.0) -; E_ERROR - fatal run-time errors -; E_RECOVERABLE_ERROR - almost fatal run-time errors -; E_WARNING - run-time warnings (non-fatal errors) -; E_PARSE - compile-time parse errors -; E_NOTICE - run-time notices (these are warnings which often result -; from a bug in your code, but it's possible that it was -; intentional (e.g., using an uninitialized variable and -; relying on the fact it is automatically initialized to an -; empty string) -; E_STRICT - run-time notices, enable to have PHP suggest changes -; to your code which will ensure the best interoperability -; and forward compatibility of your code -; E_CORE_ERROR - fatal errors that occur during PHP's initial startup -; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's -; initial startup -; E_COMPILE_ERROR - fatal compile-time errors -; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) -; E_USER_ERROR - user-generated error message -; E_USER_WARNING - user-generated warning message -; E_USER_NOTICE - user-generated notice message -; E_DEPRECATED - warn about code that will not work in future versions -; of PHP -; E_USER_DEPRECATED - user-generated deprecation warnings -; -; Common Values: -; E_ALL (Show all errors, warnings and notices including coding standards.) -; E_ALL & ~E_NOTICE (Show all errors, except for notices) -; E_ALL & ~E_NOTICE & ~E_STRICT (Show all errors, except for notices and coding standards warnings.) -; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors) -; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED -; Development Value: E_ALL -; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT -; http://php.net/error-reporting -error_reporting = E_ALL - -; This directive controls whether or not and where PHP will output errors, -; notices and warnings too. Error output is very useful during development, but -; it could be very dangerous in production environments. Depending on the code -; which is triggering the error, sensitive information could potentially leak -; out of your application such as database usernames and passwords or worse. -; For production environments, we recommend logging errors rather than -; sending them to STDOUT. -; Possible Values: -; Off = Do not display any errors -; stderr = Display errors to STDERR (affects only CGI/CLI binaries!) -; On or stdout = Display errors to STDOUT -; Default Value: On -; Development Value: On -; Production Value: Off -; http://php.net/display-errors -display_errors = On - -; The display of errors which occur during PHP's startup sequence are handled -; separately from display_errors. PHP's default behavior is to suppress those -; errors from clients. Turning the display of startup errors on can be useful in -; debugging configuration problems. We strongly recommend you -; set this to 'off' for production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/display-startup-errors -display_startup_errors = Off - -; Besides displaying errors, PHP can also log errors to locations such as a -; server-specific log, STDERR, or a location specified by the error_log -; directive found below. While errors should not be displayed on productions -; servers they should still be monitored and logging is a great way to do that. -; Default Value: Off -; Development Value: On -; Production Value: On -; http://php.net/log-errors -log_errors = On - -; Set maximum length of log_errors. In error_log information about the source is -; added. The default is 1024 and 0 allows to not apply any maximum length at all. -; http://php.net/log-errors-max-len -log_errors_max_len = 1024 - -; Do not log repeated messages. Repeated errors must occur in same file on same -; line unless ignore_repeated_source is set true. -; http://php.net/ignore-repeated-errors -ignore_repeated_errors = Off - -; Ignore source of message when ignoring repeated messages. When this setting -; is On you will not log errors with repeated messages from different files or -; source lines. -; http://php.net/ignore-repeated-source -ignore_repeated_source = Off - -; If this parameter is set to Off, then memory leaks will not be shown (on -; stdout or in the log). This has only effect in a debug compile, and if -; error reporting includes E_WARNING in the allowed list -; http://php.net/report-memleaks -report_memleaks = On - -; This setting is on by default. -;report_zend_debug = 0 - -; Store the last error/warning message in $php_errormsg (boolean). Setting this value -; to On can assist in debugging and is appropriate for development servers. It should -; however be disabled on production servers. -; Default Value: Off -; Development Value: On -; Production Value: Off -; http://php.net/track-errors -track_errors = Off - -; Turn off normal error reporting and emit XML-RPC error XML -; http://php.net/xmlrpc-errors -;xmlrpc_errors = 0 - -; An XML-RPC faultCode -;xmlrpc_error_number = 0 - -; When PHP displays or logs an error, it has the capability of formatting the -; error message as HTML for easier reading. This directive controls whether -; the error message is formatted as HTML or not. -; Note: This directive is hardcoded to Off for the CLI SAPI -; Default Value: On -; Development Value: On -; Production value: On -; http://php.net/html-errors -html_errors = On - -; If html_errors is set to On *and* docref_root is not empty, then PHP -; produces clickable error messages that direct to a page describing the error -; or function causing the error in detail. -; You can download a copy of the PHP manual from http://php.net/docs -; and change docref_root to the base URL of your local copy including the -; leading '/'. You must also specify the file extension being used including -; the dot. PHP's default behavior is to leave these settings empty, in which -; case no links to documentation are generated. -; Note: Never use this feature for production boxes. -; http://php.net/docref-root -; Examples -;docref_root = "/phpmanual/" - -; http://php.net/docref-ext -;docref_ext = .html - -; String to output before an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-prepend-string -; Example: -;error_prepend_string = "<span style='color: #ff0000'>" - -; String to output after an error message. PHP's default behavior is to leave -; this setting blank. -; http://php.net/error-append-string -; Example: -;error_append_string = "</span>" - -; Log errors to specified file. PHP's default behavior is to leave this value -; empty. -; http://php.net/error-log -; Example: -;error_log = php_errors.log -; Log errors to syslog (Event Log on Windows). -;error_log = syslog - -;windows.show_crt_warning -; Default value: 0 -; Development value: 0 -; Production value: 0 - -;;;;;;;;;;;;;;;;; -; Data Handling ; -;;;;;;;;;;;;;;;;; - -; The separator used in PHP generated URLs to separate arguments. -; PHP's default setting is "&". -; http://php.net/arg-separator.output -; Example: -;arg_separator.output = "&" - -; List of separator(s) used by PHP to parse input URLs into variables. -; PHP's default setting is "&". -; NOTE: Every character in this directive is considered as separator! -; http://php.net/arg-separator.input -; Example: -;arg_separator.input = ";&" - -; This directive determines which super global arrays are registered when PHP -; starts up. G,P,C,E & S are abbreviations for the following respective super -; globals: GET, POST, COOKIE, ENV and SERVER. There is a performance penalty -; paid for the registration of these arrays and because ENV is not as commonly -; used as the others, ENV is not recommended on productions servers. You -; can still get access to the environment variables through getenv() should you -; need to. -; Default Value: "EGPCS" -; Development Value: "GPCS" -; Production Value: "GPCS"; -; http://php.net/variables-order -variables_order = "GPCS" - -; This directive determines which super global data (G,P & C) should be -; registered into the super global array REQUEST. If so, it also determines -; the order in which that data is registered. The values for this directive -; are specified in the same manner as the variables_order directive, -; EXCEPT one. Leaving this value empty will cause PHP to use the value set -; in the variables_order directive. It does not mean it will leave the super -; globals array REQUEST empty. -; Default Value: None -; Development Value: "GP" -; Production Value: "GP" -; http://php.net/request-order -request_order = "GP" - -; This directive determines whether PHP registers $argv & $argc each time it -; runs. $argv contains an array of all the arguments passed to PHP when a script -; is invoked. $argc contains an integer representing the number of arguments -; that were passed when the script was invoked. These arrays are extremely -; useful when running scripts from the command line. When this directive is -; enabled, registering these variables consumes CPU cycles and memory each time -; a script is executed. For performance reasons, this feature should be disabled -; on production servers. -; Note: This directive is hardcoded to On for the CLI SAPI -; Default Value: On -; Development Value: Off -; Production Value: Off -; http://php.net/register-argc-argv -register_argc_argv = Off - -; When enabled, the ENV, REQUEST and SERVER variables are created when they're -; first used (Just In Time) instead of when the script starts. If these -; variables are not used within a script, having this directive on will result -; in a performance gain. The PHP directive register_argc_argv must be disabled -; for this directive to have any affect. -; http://php.net/auto-globals-jit -auto_globals_jit = On - -; Whether PHP will read the POST data. -; This option is enabled by default. -; Most likely, you won't want to disable this option globally. It causes $_POST -; and $_FILES to always be empty; the only way you will be able to read the -; POST data will be through the php://input stream wrapper. This can be useful -; to proxy requests or to process the POST data in a memory efficient fashion. -; http://php.net/enable-post-data-reading -;enable_post_data_reading = Off - -; Maximum size of POST data that PHP will accept. -; Its value may be 0 to disable the limit. It is ignored if POST data reading -; is disabled through enable_post_data_reading. -; http://php.net/post-max-size -post_max_size = 200M - -; Automatically add files before PHP document. -; http://php.net/auto-prepend-file -auto_prepend_file = - -; Automatically add files after PHP document. -; http://php.net/auto-append-file -auto_append_file = - -; By default, PHP will output a character encoding using -; the Content-type: header. To disable sending of the charset, simply -; set it to be empty. -; -; PHP's built-in default is text/html -; http://php.net/default-mimetype -default_mimetype = "text/html" - -; PHP's default character set is set to UTF-8. -; http://php.net/default-charset -default_charset = "UTF-8" - -; PHP internal character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/internal-encoding -;internal_encoding = - -; PHP input character encoding is set to empty. -; If empty, default_charset is used. -; http://php.net/input-encoding -;input_encoding = - -; PHP output character encoding is set to empty. -; If empty, default_charset is used. -; mbstring or iconv output handler is used. -; See also output_buffer. -; http://php.net/output-encoding -;output_encoding = - -; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is -; to disable this feature and it will be removed in a future version. -; If post reading is disabled through enable_post_data_reading, -; $HTTP_RAW_POST_DATA is *NOT* populated. -; http://php.net/always-populate-raw-post-data -;always_populate_raw_post_data = -1 - -;;;;;;;;;;;;;;;;;;;;;;;;; -; Paths and Directories ; -;;;;;;;;;;;;;;;;;;;;;;;;; - -; UNIX: "/path1:/path2" -;include_path = ".:/usr/share/php" -; -; Windows: "\path1;\path2" -;include_path = ".;c:\php\includes" -; -; PHP's default setting for include_path is ".;/path/to/php/pear" -; http://php.net/include-path - -; The root of the PHP pages, used only if nonempty. -; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root -; if you are running php as a CGI under any web server (other than IIS) -; see documentation for security issues. The alternate is to use the -; cgi.force_redirect configuration below -; http://php.net/doc-root -doc_root = - -; The directory under which PHP opens the script using /~username used only -; if nonempty. -; http://php.net/user-dir -user_dir = - -; Directory in which the loadable extensions (modules) reside. -; http://php.net/extension-dir -; extension_dir = "./" -; On windows: -; extension_dir = "ext" - -; Directory where the temporary files should be placed. -; Defaults to the system default (see sys_get_temp_dir) -; sys_temp_dir = "/tmp" - -; Whether or not to enable the dl() function. The dl() function does NOT work -; properly in multithreaded servers, such as IIS or Zeus, and is automatically -; disabled on them. -; http://php.net/enable-dl -enable_dl = Off - -; cgi.force_redirect is necessary to provide security running PHP as a CGI under -; most web servers. Left undefined, PHP turns this on by default. You can -; turn it off here AT YOUR OWN RISK -; **You CAN safely turn this off for IIS, in fact, you MUST.** -; http://php.net/cgi.force-redirect -;cgi.force_redirect = 1 - -; if cgi.nph is enabled it will force cgi to always sent Status: 200 with -; every request. PHP's default behavior is to disable this feature. -;cgi.nph = 1 - -; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape -; (iPlanet) web servers, you MAY need to set an environment variable name that PHP -; will look for to know it is OK to continue execution. Setting this variable MAY -; cause security issues, KNOW WHAT YOU ARE DOING FIRST. -; http://php.net/cgi.redirect-status-env -;cgi.redirect_status_env = - -; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's -; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok -; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting -; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting -; of zero causes PHP to behave as before. Default is 1. You should fix your scripts -; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. -; http://php.net/cgi.fix-pathinfo -cgi.fix_pathinfo=0 - -; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate -; security tokens of the calling client. This allows IIS to define the -; security context that the request runs under. mod_fastcgi under Apache -; does not currently support this feature (03/17/2002) -; Set to 1 if running under IIS. Default is zero. -; http://php.net/fastcgi.impersonate -;fastcgi.impersonate = 1 - -; Disable logging through FastCGI connection. PHP's default behavior is to enable -; this feature. -;fastcgi.logging = 0 - -; cgi.rfc2616_headers configuration option tells PHP what type of headers to -; use when sending HTTP response code. If set to 0, PHP sends Status: header that -; is supported by Apache. When this option is set to 1, PHP will send -; RFC2616 compliant header. -; Default is zero. -; http://php.net/cgi.rfc2616-headers -;cgi.rfc2616_headers = 0 - -;;;;;;;;;;;;;;;; -; File Uploads ; -;;;;;;;;;;;;;;;; - -; Whether to allow HTTP file uploads. -; http://php.net/file-uploads -file_uploads = On - -; Temporary directory for HTTP uploaded files (will use system default if not -; specified). -; http://php.net/upload-tmp-dir -;upload_tmp_dir = - -; Maximum allowed size for uploaded files. -; http://php.net/upload-max-filesize -upload_max_filesize = 200M - -; Maximum number of files that can be uploaded via a single request -max_file_uploads = 20 - -;;;;;;;;;;;;;;;;;; -; Fopen wrappers ; -;;;;;;;;;;;;;;;;;; - -; Whether to allow the treatment of URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-fopen -allow_url_fopen = On - -; Whether to allow include/require to open URLs (like http:// or ftp://) as files. -; http://php.net/allow-url-include -allow_url_include = Off - -; Define the anonymous ftp password (your email address). PHP's default setting -; for this is empty. -; http://php.net/from -;from="john@doe.com" - -; Define the User-Agent string. PHP's default setting for this is empty. -; http://php.net/user-agent -;user_agent="PHP" - -; Default timeout for socket based streams (seconds) -; http://php.net/default-socket-timeout -default_socket_timeout = 60 - -; If your scripts have to deal with files from Macintosh systems, -; or you are running on a Mac and need to deal with files from -; unix or win32 systems, setting this flag will cause PHP to -; automatically detect the EOL character in those files so that -; fgets() and file() will work regardless of the source of the file. -; http://php.net/auto-detect-line-endings -;auto_detect_line_endings = Off - -;;;;;;;;;;;;;;;;;;;;;; -; Dynamic Extensions ; -;;;;;;;;;;;;;;;;;;;;;; - -; If you wish to have an extension loaded automatically, use the following -; syntax: -; -; extension=modulename.extension -; -; For example, on Windows: -; -; extension=msql.dll -; -; ... or under UNIX: -; -; extension=msql.so -; -; ... or with a path: -; -; extension=/path/to/extension/msql.so -; -; If you only provide the name of the extension, PHP will look for it in its -; default extension directory. -; - -;;;;;;;;;;;;;;;;;;; -; Module Settings ; -;;;;;;;;;;;;;;;;;;; - -[CLI Server] -; Whether the CLI web server uses ANSI color coding in its terminal output. -cli_server.color = On - -[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -date.timezone = UTC - -; http://php.net/date.default-latitude -;date.default_latitude = 31.7667 - -; http://php.net/date.default-longitude -;date.default_longitude = 35.2333 - -; http://php.net/date.sunrise-zenith -;date.sunrise_zenith = 90.583333 - -; http://php.net/date.sunset-zenith -;date.sunset_zenith = 90.583333 - -[filter] -; http://php.net/filter.default -;filter.default = unsafe_raw - -; http://php.net/filter.default-flags -;filter.default_flags = - -[iconv] -; Use of this INI entry is deprecated, use global input_encoding instead. -; If empty, default_charset or input_encoding or iconv.input_encoding is used. -; The precedence is: default_charset < intput_encoding < iconv.input_encoding -;iconv.input_encoding = - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;iconv.internal_encoding = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; If empty, default_charset or output_encoding or iconv.output_encoding is used. -; The precedence is: default_charset < output_encoding < iconv.output_encoding -; To use an output encoding conversion, iconv's output handler must be set -; otherwise output encoding conversion cannot be performed. -;iconv.output_encoding = - -[intl] -;intl.default_locale = -; This directive allows you to produce PHP errors when some error -; happens within intl functions. The value is the level of the error produced. -; Default is 0, which does not produce any errors. -;intl.error_level = E_WARNING - -[sqlite] -; http://php.net/sqlite.assoc-case -;sqlite.assoc_case = 0 - -[sqlite3] -;sqlite3.extension_dir = - -[Pcre] -;PCRE library backtracking limit. -; http://php.net/pcre.backtrack-limit -;pcre.backtrack_limit=100000 - -;PCRE library recursion limit. -;Please note that if you set this value to a high number you may consume all -;the available process stack and eventually crash PHP (due to reaching the -;stack size limit imposed by the Operating System). -; http://php.net/pcre.recursion-limit -;pcre.recursion_limit=100000 - -[Pdo] -; Whether to pool ODBC connections. Can be one of "strict", "relaxed" or "off" -; http://php.net/pdo-odbc.connection-pooling -;pdo_odbc.connection_pooling=strict - -;pdo_odbc.db2_instance_name - -[Pdo_mysql] -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/pdo_mysql.cache_size -pdo_mysql.cache_size = 2000 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/pdo_mysql.default-socket -pdo_mysql.default_socket= - -[Phar] -; http://php.net/phar.readonly -;phar.readonly = On - -; http://php.net/phar.require-hash -;phar.require_hash = On - -;phar.cache_list = - -[mail function] -; For Win32 only. -; http://php.net/smtp -SMTP = localhost -; http://php.net/smtp-port -smtp_port = 25 - -; For Win32 only. -; http://php.net/sendmail-from -;sendmail_from = me@example.com - -; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). -; http://php.net/sendmail-path -;sendmail_path = - -; Force the addition of the specified parameters to be passed as extra parameters -; to the sendmail binary. These parameters will always replace the value of -; the 5th parameter to mail(). -;mail.force_extra_parameters = - -; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename -mail.add_x_header = On - -; The path to a log file that will log all mail() calls. Log entries include -; the full path of the script, line number, To address and headers. -;mail.log = -; Log mail to syslog (Event Log on Windows). -;mail.log = syslog - -[SQL] -; http://php.net/sql.safe-mode -sql.safe_mode = Off - -[ODBC] -; http://php.net/odbc.default-db -;odbc.default_db = Not yet implemented - -; http://php.net/odbc.default-user -;odbc.default_user = Not yet implemented - -; http://php.net/odbc.default-pw -;odbc.default_pw = Not yet implemented - -; Controls the ODBC cursor model. -; Default: SQL_CURSOR_STATIC (default). -;odbc.default_cursortype - -; Allow or prevent persistent links. -; http://php.net/odbc.allow-persistent -odbc.allow_persistent = On - -; Check that a connection is still valid before reuse. -; http://php.net/odbc.check-persistent -odbc.check_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/odbc.max-persistent -odbc.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/odbc.max-links -odbc.max_links = -1 - -; Handling of LONG fields. Returns number of bytes to variables. 0 means -; passthru. -; http://php.net/odbc.defaultlrl -odbc.defaultlrl = 4096 - -; Handling of binary data. 0 means passthru, 1 return as is, 2 convert to char. -; See the documentation on odbc_binmode and odbc_longreadlen for an explanation -; of odbc.defaultlrl and odbc.defaultbinmode -; http://php.net/odbc.defaultbinmode -odbc.defaultbinmode = 1 - -;birdstep.max_links = -1 - -[Interbase] -; Allow or prevent persistent links. -ibase.allow_persistent = 1 - -; Maximum number of persistent links. -1 means no limit. -ibase.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -ibase.max_links = -1 - -; Default database name for ibase_connect(). -;ibase.default_db = - -; Default username for ibase_connect(). -;ibase.default_user = - -; Default password for ibase_connect(). -;ibase.default_password = - -; Default charset for ibase_connect(). -;ibase.default_charset = - -; Default timestamp format. -ibase.timestampformat = "%Y-%m-%d %H:%M:%S" - -; Default date format. -ibase.dateformat = "%Y-%m-%d" - -; Default time format. -ibase.timeformat = "%H:%M:%S" - -[MySQL] -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysql.allow_local_infile -mysql.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysql.allow-persistent -mysql.allow_persistent = On - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysql.cache_size -mysql.cache_size = 2000 - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysql.max-persistent -mysql.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/mysql.max-links -mysql.max_links = -1 - -; Default port number for mysql_connect(). If unset, mysql_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysql.default-port -mysql.default_port = - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysql.default-socket -mysql.default_socket = - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-host -mysql.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysql.default-user -mysql.default_user = - -; Default password for mysql_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysql.default-password -mysql.default_password = - -; Maximum time (in seconds) for connect timeout. -1 means no limit -; http://php.net/mysql.connect-timeout -mysql.connect_timeout = 60 - -; Trace mode. When trace_mode is active (=On), warnings for table/index scans and -; SQL-Errors will be displayed. -; http://php.net/mysql.trace-mode -mysql.trace_mode = Off - -[MySQLi] - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/mysqli.max-persistent -mysqli.max_persistent = -1 - -; Allow accessing, from PHP's perspective, local files with LOAD DATA statements -; http://php.net/mysqli.allow_local_infile -;mysqli.allow_local_infile = On - -; Allow or prevent persistent links. -; http://php.net/mysqli.allow-persistent -mysqli.allow_persistent = On - -; Maximum number of links. -1 means no limit. -; http://php.net/mysqli.max-links -mysqli.max_links = -1 - -; If mysqlnd is used: Number of cache slots for the internal result set cache -; http://php.net/mysqli.cache_size -mysqli.cache_size = 2000 - -; Default port number for mysqli_connect(). If unset, mysqli_connect() will use -; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the -; compile-time value defined MYSQL_PORT (in that order). Win32 will only look -; at MYSQL_PORT. -; http://php.net/mysqli.default-port -mysqli.default_port = 3306 - -; Default socket name for local MySQL connects. If empty, uses the built-in -; MySQL defaults. -; http://php.net/mysqli.default-socket -mysqli.default_socket = - -; Default host for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-host -mysqli.default_host = - -; Default user for mysql_connect() (doesn't apply in safe mode). -; http://php.net/mysqli.default-user -mysqli.default_user = - -; Default password for mysqli_connect() (doesn't apply in safe mode). -; Note that this is generally a *bad* idea to store passwords in this file. -; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw") -; and reveal this password! And of course, any users with read access to this -; file will be able to reveal the password as well. -; http://php.net/mysqli.default-pw -mysqli.default_pw = - -; Allow or prevent reconnect -mysqli.reconnect = Off - -[mysqlnd] -; Enable / Disable collection of general statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_statistics -mysqlnd.collect_statistics = On - -; Enable / Disable collection of memory usage statistics by mysqlnd which can be -; used to tune and monitor MySQL operations. -; http://php.net/mysqlnd.collect_memory_statistics -mysqlnd.collect_memory_statistics = Off - -; Size of a pre-allocated buffer used when sending commands to MySQL in bytes. -; http://php.net/mysqlnd.net_cmd_buffer_size -;mysqlnd.net_cmd_buffer_size = 2048 - -; Size of a pre-allocated buffer used for reading data sent by the server in -; bytes. -; http://php.net/mysqlnd.net_read_buffer_size -;mysqlnd.net_read_buffer_size = 32768 - -[OCI8] - -; Connection: Enables privileged connections using external -; credentials (OCI_SYSOPER, OCI_SYSDBA) -; http://php.net/oci8.privileged-connect -;oci8.privileged_connect = Off - -; Connection: The maximum number of persistent OCI8 connections per -; process. Using -1 means no limit. -; http://php.net/oci8.max-persistent -;oci8.max_persistent = -1 - -; Connection: The maximum number of seconds a process is allowed to -; maintain an idle persistent connection. Using -1 means idle -; persistent connections will be maintained forever. -; http://php.net/oci8.persistent-timeout -;oci8.persistent_timeout = -1 - -; Connection: The number of seconds that must pass before issuing a -; ping during oci_pconnect() to check the connection validity. When -; set to 0, each oci_pconnect() will cause a ping. Using -1 disables -; pings completely. -; http://php.net/oci8.ping-interval -;oci8.ping_interval = 60 - -; Connection: Set this to a user chosen connection class to be used -; for all pooled server requests with Oracle 11g Database Resident -; Connection Pooling (DRCP). To use DRCP, this value should be set to -; the same string for all web servers running the same application, -; the database pool must be configured, and the connection string must -; specify to use a pooled server. -;oci8.connection_class = - -; High Availability: Using On lets PHP receive Fast Application -; Notification (FAN) events generated when a database node fails. The -; database must also be configured to post FAN events. -;oci8.events = Off - -; Tuning: This option enables statement caching, and specifies how -; many statements to cache. Using 0 disables statement caching. -; http://php.net/oci8.statement-cache-size -;oci8.statement_cache_size = 20 - -; Tuning: Enables statement prefetching and sets the default number of -; rows that will be fetched automatically after statement execution. -; http://php.net/oci8.default-prefetch -;oci8.default_prefetch = 100 - -; Compatibility. Using On means oci_close() will not close -; oci_connect() and oci_new_connect() connections. -; http://php.net/oci8.old-oci-close-semantics -;oci8.old_oci_close_semantics = Off - -[PostgreSQL] -; Allow or prevent persistent links. -; http://php.net/pgsql.allow-persistent -pgsql.allow_persistent = On - -; Detect broken persistent links always with pg_pconnect(). -; Auto reset feature requires a little overheads. -; http://php.net/pgsql.auto-reset-persistent -pgsql.auto_reset_persistent = Off - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/pgsql.max-persistent -pgsql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -; http://php.net/pgsql.max-links -pgsql.max_links = -1 - -; Ignore PostgreSQL backends Notice message or not. -; Notice message logging require a little overheads. -; http://php.net/pgsql.ignore-notice -pgsql.ignore_notice = 0 - -; Log PostgreSQL backends Notice message or not. -; Unless pgsql.ignore_notice=0, module cannot log notice message. -; http://php.net/pgsql.log-notice -pgsql.log_notice = 0 - -[Sybase-CT] -; Allow or prevent persistent links. -; http://php.net/sybct.allow-persistent -sybct.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -; http://php.net/sybct.max-persistent -sybct.max_persistent = -1 - -; Maximum number of links (persistent + non-persistent). -1 means no limit. -; http://php.net/sybct.max-links -sybct.max_links = -1 - -; Minimum server message severity to display. -; http://php.net/sybct.min-server-severity -sybct.min_server_severity = 10 - -; Minimum client message severity to display. -; http://php.net/sybct.min-client-severity -sybct.min_client_severity = 10 - -; Set per-context timeout -; http://php.net/sybct.timeout -;sybct.timeout= - -;sybct.packet_size - -; The maximum time in seconds to wait for a connection attempt to succeed before returning failure. -; Default: one minute -;sybct.login_timeout= - -; The name of the host you claim to be connecting from, for display by sp_who. -; Default: none -;sybct.hostname= - -; Allows you to define how often deadlocks are to be retried. -1 means "forever". -; Default: 0 -;sybct.deadlock_retry_count= - -[bcmath] -; Number of decimal digits for all bcmath functions. -; http://php.net/bcmath.scale -bcmath.scale = 0 - -[browscap] -; http://php.net/browscap -;browscap = extra/browscap.ini - -[Session] -; Handler used to store/retrieve data. -; http://php.net/session.save-handler -session.save_handler = files - -; Argument passed to save_handler. In the case of files, this is the path -; where data files are stored. Note: Windows users have to change this -; variable in order to use PHP's session functions. -; -; The path can be defined as: -; -; session.save_path = "N;/path" -; -; where N is an integer. Instead of storing all the session files in -; /path, what this will do is use subdirectories N-levels deep, and -; store the session data in those directories. This is useful if -; your OS has problems with many files in one directory, and is -; a more efficient layout for servers that handle many sessions. -; -; NOTE 1: PHP will not create this directory structure automatically. -; You can use the script in the ext/session dir for that purpose. -; NOTE 2: See the section on garbage collection below if you choose to -; use subdirectories for session storage -; -; The file storage module creates files using mode 600 by default. -; You can change that by using -; -; session.save_path = "N;MODE;/path" -; -; where MODE is the octal representation of the mode. Note that this -; does not overwrite the process's umask. -; http://php.net/session.save-path -;session.save_path = "/var/lib/php5/sessions" - -; Whether to use strict session mode. -; Strict session mode does not accept uninitialized session ID and regenerate -; session ID if browser sends uninitialized session ID. Strict mode protects -; applications from session fixation via session adoption vulnerability. It is -; disabled by default for maximum compatibility, but enabling it is encouraged. -; https://wiki.php.net/rfc/strict_sessions -session.use_strict_mode = 0 - -; Whether to use cookies. -; http://php.net/session.use-cookies -session.use_cookies = 1 - -; http://php.net/session.cookie-secure -;session.cookie_secure = - -; This option forces PHP to fetch and use a cookie for storing and maintaining -; the session id. We encourage this operation as it's very helpful in combating -; session hijacking when not specifying and managing your own session id. It is -; not the be-all and end-all of session hijacking defense, but it's a good start. -; http://php.net/session.use-only-cookies -session.use_only_cookies = 1 - -; Name of the session (used as cookie name). -; http://php.net/session.name -session.name = PHPSESSID - -; Initialize session on request startup. -; http://php.net/session.auto-start -session.auto_start = 0 - -; Lifetime in seconds of cookie or, if 0, until browser is restarted. -; http://php.net/session.cookie-lifetime -session.cookie_lifetime = 0 - -; The path for which the cookie is valid. -; http://php.net/session.cookie-path -session.cookie_path = / - -; The domain for which the cookie is valid. -; http://php.net/session.cookie-domain -session.cookie_domain = - -; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting languages such as JavaScript. -; http://php.net/session.cookie-httponly -session.cookie_httponly = - -; Handler used to serialize data. php is the standard serializer of PHP. -; http://php.net/session.serialize-handler -session.serialize_handler = php - -; Defines the probability that the 'garbage collection' process is started -; on every session initialization. The probability is calculated by using -; gc_probability/gc_divisor. Where session.gc_probability is the numerator -; and gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.gc-probability -session.gc_probability = 0 - -; Defines the probability that the 'garbage collection' process is started on every -; session initialization. The probability is calculated by using the following equation: -; gc_probability/gc_divisor. Where session.gc_probability is the numerator and -; session.gc_divisor is the denominator in the equation. Setting this value to 1 -; when the session.gc_divisor value is 100 will give you approximately a 1% chance -; the gc will run on any give request. Increasing this value to 1000 will give you -; a 0.1% chance the gc will run on any give request. For high volume production servers, -; this is a more efficient approach. -; Default Value: 100 -; Development Value: 1000 -; Production Value: 1000 -; http://php.net/session.gc-divisor -session.gc_divisor = 1000 - -; After this number of seconds, stored data will be seen as 'garbage' and -; cleaned up by the garbage collection process. -; http://php.net/session.gc-maxlifetime -session.gc_maxlifetime = 1440 - -; NOTE: If you are using the subdirectory option for storing session files -; (see session.save_path above), then garbage collection does *not* -; happen automatically. You will need to do your own garbage -; collection through a shell script, cron entry, or some other method. -; For example, the following script would is the equivalent of -; setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes): -; find /path/to/sessions -cmin +24 -type f | xargs rm - -; Check HTTP Referer to invalidate externally stored URLs containing ids. -; HTTP_REFERER has to contain this substring for the session to be -; considered as valid. -; http://php.net/session.referer-check -session.referer_check = - -; How many bytes to read from the file. -; http://php.net/session.entropy-length -;session.entropy_length = 32 - -; Specified here to create the session id. -; http://php.net/session.entropy-file -; Defaults to /dev/urandom -; On systems that don't have /dev/urandom but do have /dev/arandom, this will default to /dev/arandom -; If neither are found at compile time, the default is no entropy file. -; On windows, setting the entropy_length setting will activate the -; Windows random source (using the CryptoAPI) -;session.entropy_file = /dev/urandom - -; Set to {nocache,private,public,} to determine HTTP caching aspects -; or leave this empty to avoid sending anti-caching headers. -; http://php.net/session.cache-limiter -session.cache_limiter = nocache - -; Document expires after n minutes. -; http://php.net/session.cache-expire -session.cache_expire = 180 - -; trans sid support is disabled by default. -; Use of trans sid may risk your users' security. -; Use this option with caution. -; - User may send URL contains active session ID -; to other person via. email/irc/etc. -; - URL that contains active session ID may be stored -; in publicly accessible computer. -; - User may access your site with the same session ID -; always using URL stored in browser's history or bookmarks. -; http://php.net/session.use-trans-sid -session.use_trans_sid = 0 - -; Select a hash function for use in generating session ids. -; Possible Values -; 0 (MD5 128 bits) -; 1 (SHA-1 160 bits) -; This option may also be set to the name of any hash function supported by -; the hash extension. A list of available hashes is returned by the hash_algos() -; function. -; http://php.net/session.hash-function -session.hash_function = 0 - -; Define how many bits are stored in each character when converting -; the binary hash data to something readable. -; Possible values: -; 4 (4 bits: 0-9, a-f) -; 5 (5 bits: 0-9, a-v) -; 6 (6 bits: 0-9, a-z, A-Z, "-", ",") -; Default Value: 4 -; Development Value: 5 -; Production Value: 5 -; http://php.net/session.hash-bits-per-character -session.hash_bits_per_character = 5 - -; The URL rewriter will look for URLs in a defined set of HTML tags. -; form/fieldset are special; if you include them here, the rewriter will -; add a hidden <input> field with the info which is otherwise appended -; to URLs. If you want XHTML conformity, remove the form entry. -; Note that all valid entries require a "=", even if no value follows. -; Default Value: "a=href,area=href,frame=src,form=,fieldset=" -; Development Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; Production Value: "a=href,area=href,frame=src,input=src,form=fakeentry" -; http://php.net/url-rewriter.tags -url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry" - -; Enable upload progress tracking in $_SESSION -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.enabled -;session.upload_progress.enabled = On - -; Cleanup the progress information as soon as all POST data has been read -; (i.e. upload completed). -; Default Value: On -; Development Value: On -; Production Value: On -; http://php.net/session.upload-progress.cleanup -;session.upload_progress.cleanup = On - -; A prefix used for the upload progress key in $_SESSION -; Default Value: "upload_progress_" -; Development Value: "upload_progress_" -; Production Value: "upload_progress_" -; http://php.net/session.upload-progress.prefix -;session.upload_progress.prefix = "upload_progress_" - -; The index name (concatenated with the prefix) in $_SESSION -; containing the upload progress information -; Default Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Development Value: "PHP_SESSION_UPLOAD_PROGRESS" -; Production Value: "PHP_SESSION_UPLOAD_PROGRESS" -; http://php.net/session.upload-progress.name -;session.upload_progress.name = "PHP_SESSION_UPLOAD_PROGRESS" - -; How frequently the upload progress should be updated. -; Given either in percentages (per-file), or in bytes -; Default Value: "1%" -; Development Value: "1%" -; Production Value: "1%" -; http://php.net/session.upload-progress.freq -;session.upload_progress.freq = "1%" - -; The minimum delay between updates, in seconds -; Default Value: 1 -; Development Value: 1 -; Production Value: 1 -; http://php.net/session.upload-progress.min-freq -;session.upload_progress.min_freq = "1" - -[MSSQL] -; Allow or prevent persistent links. -mssql.allow_persistent = On - -; Maximum number of persistent links. -1 means no limit. -mssql.max_persistent = -1 - -; Maximum number of links (persistent+non persistent). -1 means no limit. -mssql.max_links = -1 - -; Minimum error severity to display. -mssql.min_error_severity = 10 - -; Minimum message severity to display. -mssql.min_message_severity = 10 - -; Compatibility mode with old versions of PHP 3.0. -mssql.compatibility_mode = Off - -; Connect timeout -;mssql.connect_timeout = 5 - -; Query timeout -;mssql.timeout = 60 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textlimit = 4096 - -; Valid range 0 - 2147483647. Default = 4096. -;mssql.textsize = 4096 - -; Limits the number of records in each batch. 0 = all records in one batch. -;mssql.batchsize = 0 - -; Specify how datetime and datetim4 columns are returned -; On => Returns data converted to SQL server settings -; Off => Returns values as YYYY-MM-DD hh:mm:ss -;mssql.datetimeconvert = On - -; Use NT authentication when connecting to the server -mssql.secure_connection = Off - -; Specify max number of processes. -1 = library default -; msdlib defaults to 25 -; FreeTDS defaults to 4096 -;mssql.max_procs = -1 - -; Specify client character set. -; If empty or not set the client charset from freetds.conf is used -; This is only used when compiled with FreeTDS -;mssql.charset = "ISO-8859-1" - -[Assertion] -; Assert(expr); active by default. -; http://php.net/assert.active -;assert.active = On - -; Issue a PHP warning for each failed assertion. -; http://php.net/assert.warning -;assert.warning = On - -; Don't bail out by default. -; http://php.net/assert.bail -;assert.bail = Off - -; User-function to be called if an assertion fails. -; http://php.net/assert.callback -;assert.callback = 0 - -; Eval the expression with current error_reporting(). Set to true if you want -; error_reporting(0) around the eval(). -; http://php.net/assert.quiet-eval -;assert.quiet_eval = 0 - -[COM] -; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs -; http://php.net/com.typelib-file -;com.typelib_file = - -; allow Distributed-COM calls -; http://php.net/com.allow-dcom -;com.allow_dcom = true - -; autoregister constants of a components typlib on com_load() -; http://php.net/com.autoregister-typelib -;com.autoregister_typelib = true - -; register constants casesensitive -; http://php.net/com.autoregister-casesensitive -;com.autoregister_casesensitive = false - -; show warnings on duplicate constant registrations -; http://php.net/com.autoregister-verbose -;com.autoregister_verbose = true - -; The default character set code-page to use when passing strings to and from COM objects. -; Default: system ANSI code page -;com.code_page= - -[mbstring] -; language for internal character representation. -; This affects mb_send_mail() and mbstrig.detect_order. -; http://php.net/mbstring.language -;mbstring.language = Japanese - -; Use of this INI entry is deprecated, use global internal_encoding instead. -; internal/script encoding. -; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) -; If empty, default_charset or internal_encoding or iconv.internal_encoding is used. -; The precedence is: default_charset < internal_encoding < iconv.internal_encoding -;mbstring.internal_encoding = - -; Use of this INI entry is deprecated, use global input_encoding instead. -; http input encoding. -; mbstring.encoding_traslation = On is needed to use this setting. -; If empty, default_charset or input_encoding or mbstring.input is used. -; The precedence is: default_charset < intput_encoding < mbsting.http_input -; http://php.net/mbstring.http-input -;mbstring.http_input = - -; Use of this INI entry is deprecated, use global output_encoding instead. -; http output encoding. -; mb_output_handler must be registered as output buffer to function. -; If empty, default_charset or output_encoding or mbstring.http_output is used. -; The precedence is: default_charset < output_encoding < mbstring.http_output -; To use an output encoding conversion, mbstring's output handler must be set -; otherwise output encoding conversion cannot be performed. -; http://php.net/mbstring.http-output -;mbstring.http_output = - -; enable automatic encoding translation according to -; mbstring.internal_encoding setting. Input chars are -; converted to internal encoding by setting this to On. -; Note: Do _not_ use automatic encoding translation for -; portable libs/applications. -; http://php.net/mbstring.encoding-translation -;mbstring.encoding_translation = Off - -; automatic encoding detection order. -; "auto" detect order is changed according to mbstring.language -; http://php.net/mbstring.detect-order -;mbstring.detect_order = auto - -; substitute_character used when character cannot be converted -; one from another -; http://php.net/mbstring.substitute-character -;mbstring.substitute_character = none - -; overload(replace) single byte functions by mbstring functions. -; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(), -; etc. Possible values are 0,1,2,4 or combination of them. -; For example, 7 for overload everything. -; 0: No overload -; 1: Overload mail() function -; 2: Overload str*() functions -; 4: Overload ereg*() functions -; http://php.net/mbstring.func-overload -;mbstring.func_overload = 0 - -; enable strict encoding detection. -; Default: Off -;mbstring.strict_detection = On - -; This directive specifies the regex pattern of content types for which mb_output_handler() -; is activated. -; Default: mbstring.http_output_conv_mimetype=^(text/|application/xhtml\+xml) -;mbstring.http_output_conv_mimetype= - -[gd] -; Tell the jpeg decode to ignore warnings and try to create -; a gd image. The warning will then be displayed as notices -; disabled by default -; http://php.net/gd.jpeg-ignore-warning -;gd.jpeg_ignore_warning = 0 - -[exif] -; Exif UNICODE user comments are handled as UCS-2BE/UCS-2LE and JIS as JIS. -; With mbstring support this will automatically be converted into the encoding -; given by corresponding encode setting. When empty mbstring.internal_encoding -; is used. For the decode settings you can distinguish between motorola and -; intel byte order. A decode setting cannot be empty. -; http://php.net/exif.encode-unicode -;exif.encode_unicode = ISO-8859-15 - -; http://php.net/exif.decode-unicode-motorola -;exif.decode_unicode_motorola = UCS-2BE - -; http://php.net/exif.decode-unicode-intel -;exif.decode_unicode_intel = UCS-2LE - -; http://php.net/exif.encode-jis -;exif.encode_jis = - -; http://php.net/exif.decode-jis-motorola -;exif.decode_jis_motorola = JIS - -; http://php.net/exif.decode-jis-intel -;exif.decode_jis_intel = JIS - -[Tidy] -; The path to a default tidy configuration file to use when using tidy -; http://php.net/tidy.default-config -;tidy.default_config = /usr/local/lib/php/default.tcfg - -; Should tidy clean and repair output automatically? -; WARNING: Do not use this option if you are generating non-html content -; such as dynamic images -; http://php.net/tidy.clean-output -tidy.clean_output = Off - -[soap] -; Enables or disables WSDL caching feature. -; http://php.net/soap.wsdl-cache-enabled -soap.wsdl_cache_enabled=1 - -; Sets the directory name where SOAP extension will put cache files. -; http://php.net/soap.wsdl-cache-dir -soap.wsdl_cache_dir="/tmp" - -; (time to live) Sets the number of second while cached file will be used -; instead of original one. -; http://php.net/soap.wsdl-cache-ttl -soap.wsdl_cache_ttl=86400 - -; Sets the size of the cache limit. (Max. number of WSDL files to cache) -soap.wsdl_cache_limit = 5 - -[sysvshm] -; A default size of the shared memory segment -;sysvshm.init_mem = 10000 - -[ldap] -; Sets the maximum number of open links or -1 for unlimited. -ldap.max_links = -1 - -[mcrypt] -; For more information about mcrypt settings see http://php.net/mcrypt-module-open - -; Directory where to load mcrypt algorithms -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.algorithms_dir= - -; Directory where to load mcrypt modes -; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt) -;mcrypt.modes_dir= - -[dba] -;dba.default_handler= - -[opcache] -; Determines if Zend OPCache is enabled -;opcache.enable=0 - -; Determines if Zend OPCache is enabled for the CLI version of PHP -;opcache.enable_cli=0 - -; The OPcache shared memory storage size. -;opcache.memory_consumption=64 - -; The amount of memory for interned strings in Mbytes. -;opcache.interned_strings_buffer=4 - -; The maximum number of keys (scripts) in the OPcache hash table. -; Only numbers between 200 and 100000 are allowed. -;opcache.max_accelerated_files=2000 - -; The maximum percentage of "wasted" memory until a restart is scheduled. -;opcache.max_wasted_percentage=5 - -; When this directive is enabled, the OPcache appends the current working -; directory to the script key, thus eliminating possible collisions between -; files with the same name (basename). Disabling the directive improves -; performance, but may break existing applications. -;opcache.use_cwd=1 - -; When disabled, you must reset the OPcache manually or restart the -; webserver for changes to the filesystem to take effect. -;opcache.validate_timestamps=1 - -; How often (in seconds) to check file timestamps for changes to the shared -; memory storage allocation. ("1" means validate once per second, but only -; once per request. "0" means always validate) -;opcache.revalidate_freq=2 - -; Enables or disables file search in include_path optimization -;opcache.revalidate_path=0 - -; If disabled, all PHPDoc comments are dropped from the code to reduce the -; size of the optimized code. -;opcache.save_comments=1 - -; If disabled, PHPDoc comments are not loaded from SHM, so "Doc Comments" -; may be always stored (save_comments=1), but not loaded by applications -; that don't need them anyway. -;opcache.load_comments=1 - -; If enabled, a fast shutdown sequence is used for the accelerated code -;opcache.fast_shutdown=0 - -; Allow file existence override (file_exists, etc.) performance feature. -;opcache.enable_file_override=0 - -; A bitmask, where each bit enables or disables the appropriate OPcache -; passes -;opcache.optimization_level=0xffffffff - -;opcache.inherited_hack=1 -;opcache.dups_fix=0 - -; The location of the OPcache blacklist file (wildcards allowed). -; Each OPcache blacklist file is a text file that holds the names of files -; that should not be accelerated. The file format is to add each filename -; to a new line. The filename may be a full path or just a file prefix -; (i.e., /var/www/x blacklists all the files and directories in /var/www -; that start with 'x'). Line starting with a ; are ignored (comments). -;opcache.blacklist_filename= - -; Allows exclusion of large files from being cached. By default all files -; are cached. -;opcache.max_file_size=0 - -; Check the cache checksum each N requests. -; The default value of "0" means that the checks are disabled. -;opcache.consistency_checks=0 - -; How long to wait (in seconds) for a scheduled restart to begin if the cache -; is not being accessed. -;opcache.force_restart_timeout=180 - -; OPcache error_log file name. Empty string assumes "stderr". -;opcache.error_log= - -; All OPcache errors go to the Web server log. -; By default, only fatal errors (level 0) or errors (level 1) are logged. -; You can also enable warnings (level 2), info messages (level 3) or -; debug messages (level 4). -;opcache.log_verbosity_level=1 - -; Preferred Shared Memory back-end. Leave empty and let the system decide. -;opcache.preferred_memory_model= - -; Protect the shared memory from unexpected writing during script execution. -; Useful for internal debugging only. -;opcache.protect_memory=0 - -[curl] -; A default value for the CURLOPT_CAINFO option. This is required to be an -; absolute path. -;curl.cainfo = - -[openssl] -; The location of a Certificate Authority (CA) file on the local filesystem -; to use when verifying the identity of SSL/TLS peers. Most users should -; not specify a value for this directive as PHP will attempt to use the -; OS-managed cert stores in its absence. If specified, this value may still -; be overridden on a per-stream basis via the "cafile" SSL stream context -; option. -;openssl.cafile= - -; If openssl.cafile is not specified or if the CA file is not found, the -; directory pointed to by openssl.capath is searched for a suitable -; certificate. This value must be a correctly hashed certificate directory. -; Most users should not specify a value for this directive as PHP will -; attempt to use the OS-managed cert stores in its absence. If specified, -; this value may still be overridden on a per-stream basis via the "capath" -; SSL stream context option. -;openssl.capath= - -; Local Variables: -; tab-width: 4 -; End: diff --git a/vagrant/pony.fm.mysql.config b/vagrant/pony.fm.mysql.config deleted file mode 100644 index f4d904c7..00000000 --- a/vagrant/pony.fm.mysql.config +++ /dev/null @@ -1,127 +0,0 @@ -# -# The MySQL database server configuration file. -# -# You can copy this to one of: -# - "/etc/mysql/my.cnf" to set global options, -# - "~/.my.cnf" to set user-specific options. -# -# One can use all long options that the program supports. -# Run program with --help to get a list of available options and with -# --print-defaults to see which it would actually understand and use. -# -# For explanations see -# http://dev.mysql.com/doc/mysql/en/server-system-variables.html - -# This will be passed to all mysql clients -# It has been reported that passwords should be enclosed with ticks/quotes -# escpecially if they contain "#" chars... -# Remember to edit /etc/mysql/debian.cnf when changing the socket location. -[client] -port = 3306 -socket = /var/run/mysqld/mysqld.sock - -# Here is entries for some specific programs -# The following values assume you have at least 32M ram - -# This was formally known as [safe_mysqld]. Both versions are currently parsed. -[mysqld_safe] -socket = /var/run/mysqld/mysqld.sock -nice = 0 - -[mysqld] -# -# * Basic Settings -# -user = mysql -pid-file = /var/run/mysqld/mysqld.pid -socket = /var/run/mysqld/mysqld.sock -port = 3306 -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -lc-messages-dir = /usr/share/mysql -skip-external-locking -# -# Instead of skip-networking the default is now to listen only on -# localhost which is more compatible and is not less secure. -bind-address = 0.0.0.0 -# -# * Fine Tuning -# -key_buffer = 16M -max_allowed_packet = 16M -thread_stack = 192K -thread_cache_size = 8 -# This replaces the startup script and checks MyISAM tables if needed -# the first time they are touched -myisam-recover = BACKUP -#max_connections = 100 -#table_cache = 64 -#thread_concurrency = 10 -# -# * Query Cache Configuration -# -query_cache_limit = 1M -query_cache_size = 16M -# -# * Logging and Replication -# -# Both location gets rotated by the cronjob. -# Be aware that this log type is a performance killer. -# As of 5.1 you can enable the log at runtime! -#general_log_file = /var/log/mysql/mysql.log -#general_log = 1 -# -# Error log - should be very few entries. -# -log_error = /vagrant/storage/logs/system/mysql-error.log -# -# Here you can see queries with especially long duration -#log_slow_queries = /var/log/mysql/mysql-slow.log -#long_query_time = 2 -#log-queries-not-using-indexes -# -# The following can be used as easy to replay backup logs or for replication. -# note: if you are setting up a replication slave, see README.Debian about -# other settings you may need to change. -#server-id = 1 -#log_bin = /var/log/mysql/mysql-bin.log -expire_logs_days = 10 -max_binlog_size = 100M -#binlog_do_db = include_database_name -#binlog_ignore_db = include_database_name -# -# * InnoDB -# -# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. -# Read the manual for more InnoDB related options. There are many! -# -# * Security Features -# -# Read the manual, too, if you want chroot! -# chroot = /var/lib/mysql/ -# -# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". -# -# ssl-ca=/etc/mysql/cacert.pem -# ssl-cert=/etc/mysql/server-cert.pem -# ssl-key=/etc/mysql/server-key.pem - - - -[mysqldump] -quick -quote-names -max_allowed_packet = 16M - -[mysql] -#no-auto-rehash # faster start of mysql but no tab completition - -[isamchk] -key_buffer = 16M - -# -# * IMPORTANT: Additional settings that can override those from this file! -# The files must end with '.cnf', otherwise they'll be ignored. -# -!includedir /etc/mysql/conf.d/ diff --git a/vagrant/pony.fm.nginx.config b/vagrant/pony.fm.nginx.config index 0f6c0efe..914193af 100644 --- a/vagrant/pony.fm.nginx.config +++ b/vagrant/pony.fm.nginx.config @@ -1,85 +1,85 @@ user vagrant; -worker_processes 4; +worker_processes auto; pid /run/nginx.pid; events { - worker_connections 768; - # multi_accept on; + worker_connections 768; + # multi_accept on; } http { - ## - # Basic Settings - ## + ## + # Basic Settings + ## - sendfile on; - tcp_nopush on; - tcp_nodelay on; - keepalive_timeout 65; - types_hash_max_size 2048; - # server_tokens off; + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; - server_names_hash_bucket_size 64; - # server_name_in_redirect off; + server_names_hash_bucket_size 64; + # server_name_in_redirect off; - include /etc/nginx/mime.types; - default_type application/octet-stream; + include /etc/nginx/mime.types; + default_type application/octet-stream; - ## - # SSL Settings - ## + ## + # SSL Settings + ## - ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE - ssl_prefer_server_ciphers on; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; - ## - # Logging Settings - ## + ## + # Logging Settings + ## - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; - ## - # Gzip Settings - ## + ## + # Gzip Settings + ## - gzip on; - gzip_disable "msie6"; + gzip on; + gzip_disable "msie6"; - # gzip_vary on; - # gzip_proxied any; - # gzip_comp_level 6; - # gzip_buffers 16 8k; - # gzip_http_version 1.1; - # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; - ## - # Virtual Host Configs - ## + ## + # Virtual Host Configs + ## - include /etc/nginx/conf.d/*.conf; - include /etc/nginx/sites-enabled/*; + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; } #mail { -# # See sample authentication script at: -# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript +# # See sample authentication script at: +# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript # -# # auth_http localhost/auth.php; -# # pop3_capabilities "TOP" "USER"; -# # imap_capabilities "IMAP4rev1" "UIDPLUS"; +# # auth_http localhost/auth.php; +# # pop3_capabilities "TOP" "USER"; +# # imap_capabilities "IMAP4rev1" "UIDPLUS"; # -# server { -# listen localhost:110; -# protocol pop3; -# proxy on; -# } +# server { +# listen localhost:110; +# protocol pop3; +# proxy on; +# } # -# server { -# listen localhost:143; -# protocol imap; -# proxy on; -# } +# server { +# listen localhost:143; +# protocol imap; +# proxy on; +# } #} diff --git a/vagrant/pony.fm.nginx.site.config b/vagrant/pony.fm.nginx.site.config index 45743363..abd4cc7b 100644 --- a/vagrant/pony.fm.nginx.site.config +++ b/vagrant/pony.fm.nginx.site.config @@ -1,52 +1,39 @@ server { - listen 80; + listen 80 default_server; - client_max_body_size 200M; - gzip on; - gzip_comp_level 4; - gzip_min_length 1280; - gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/bmp application/json; - gzip_vary on; + server_name ponyfm-dev.poni api.ponyfm-dev.poni; + access_log /vagrant/storage/logs/system/nginx-access.log; + error_log /vagrant/storage/logs/system/nginx-error.log; + root /vagrant/public; - server_name ponyfm-dev.poni api.ponyfm-dev.poni; - access_log /vagrant/storage/logs/system/nginx-access.log; - error_log /vagrant/storage/logs/system/nginx-error.log; - root /vagrant/public; + client_max_body_size 220M; - location / { - index index.html index.php; - location ~* \.(?:ttf|ttc|otf|eot|woff|font.css)$ { - add_header "Access-Control-Allow-Origin" "*"; - } + location / { + index index.php; - if (!-e $request_filename) { - rewrite ^/(.*)$ /index.php?/$1 last; - break; - } - } + try_files $uri $uri/ /index.php$is_args$args; + } - location /dev-styles/ { - alias /vagrant/app/styles/; - } + location ~* \.(?:ttf|ttc|otf|eot|woff|font.css)$ { + add_header "Access-Control-Allow-Origin" "*"; + } - location /dev-scripts/ { - alias /vagrant/app/scripts/; - } + expires off; - location ~ \.php$ { - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass unix:/var/run/php5-fpm.sock; - fastcgi_index index.php; - include fastcgi_params; - } + location /vagrant-files { + internal; + alias /vagrant-files/; + } - expires off; + location ~* \.php$ { + try_files $uri = 404; - error_page 404 /index.php; - error_page 403 /403.html; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_pass unix:/run/php/php7.0-fpm.sock; - location /vagrant-files { - internal; - alias /vagrant-files/; - } + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; + } }