mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-02-16 18:14:23 +01:00
Lots of minor code cleanup.
This commit is contained in:
parent
b46ba956d0
commit
9a9ac7e5a1
36 changed files with 58 additions and 117 deletions
|
@ -35,13 +35,13 @@ class AlbumDownloader
|
|||
*/
|
||||
private $_format;
|
||||
|
||||
function __construct($album, $format)
|
||||
public function __construct($album, $format)
|
||||
{
|
||||
$this->_album = $album;
|
||||
$this->_format = $format;
|
||||
}
|
||||
|
||||
function download()
|
||||
public function download()
|
||||
{
|
||||
$zip = new ZipStream($this->_album->user->display_name.' - '.$this->_album->title.'.zip');
|
||||
$zip->setComment(
|
||||
|
|
|
@ -34,7 +34,7 @@ class AddTrackToPlaylistCommand extends CommandBase
|
|||
/** @var Playlist */
|
||||
private $_playlist;
|
||||
|
||||
function __construct($playlistId, $trackId)
|
||||
public function __construct($playlistId, $trackId)
|
||||
{
|
||||
$this->_playlist = Playlist::find($playlistId);
|
||||
$this->_track = Track::find($trackId);
|
||||
|
|
|
@ -29,7 +29,7 @@ class CreateAlbumCommand extends CommandBase
|
|||
{
|
||||
private $_input;
|
||||
|
||||
function __construct($input)
|
||||
public function __construct($input)
|
||||
{
|
||||
$this->_input = $input;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ class CreateCommentCommand extends CommandBase
|
|||
private $_id;
|
||||
private $_type;
|
||||
|
||||
function __construct($type, $id, $input)
|
||||
public function __construct($type, $id, $input)
|
||||
{
|
||||
$this->_input = $input;
|
||||
$this->_id = $id;
|
||||
|
|
|
@ -29,7 +29,7 @@ class CreatePlaylistCommand extends CommandBase
|
|||
{
|
||||
private $_input;
|
||||
|
||||
function __construct($input)
|
||||
public function __construct($input)
|
||||
{
|
||||
$this->_input = $input;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ class DeleteAlbumCommand extends CommandBase
|
|||
/** @var Album */
|
||||
private $_album;
|
||||
|
||||
function __construct($albumId)
|
||||
public function __construct($albumId)
|
||||
{
|
||||
$this->_albumId = $albumId;
|
||||
$this->_album = Album::find($albumId);
|
||||
|
|
|
@ -31,7 +31,7 @@ class DeletePlaylistCommand extends CommandBase
|
|||
/** @var Playlist */
|
||||
private $_playlist;
|
||||
|
||||
function __construct($playlistId)
|
||||
public function __construct($playlistId)
|
||||
{
|
||||
$this->_playlistId = $playlistId;
|
||||
$this->_playlist = Playlist::find($playlistId);
|
||||
|
|
|
@ -31,7 +31,7 @@ class DeleteTrackCommand extends CommandBase
|
|||
/** @var Track */
|
||||
private $_track;
|
||||
|
||||
function __construct($trackId)
|
||||
public function __construct($trackId)
|
||||
{
|
||||
$this->_trackId = $trackId;
|
||||
$this->_track = Track::find($trackId);
|
||||
|
|
|
@ -36,7 +36,7 @@ class EditAlbumCommand extends CommandBase
|
|||
/** @var Album */
|
||||
private $_album;
|
||||
|
||||
function __construct($trackId, $input)
|
||||
public function __construct($trackId, $input)
|
||||
{
|
||||
$this->_input = $input;
|
||||
$this->_albumId = $trackId;
|
||||
|
|
|
@ -31,7 +31,7 @@ class EditPlaylistCommand extends CommandBase
|
|||
private $_playlistId;
|
||||
private $_playlist;
|
||||
|
||||
function __construct($playlistId, $input)
|
||||
public function __construct($playlistId, $input)
|
||||
{
|
||||
$this->_input = $input;
|
||||
$this->_playlistId = $playlistId;
|
||||
|
|
|
@ -40,7 +40,7 @@ class EditTrackCommand extends CommandBase
|
|||
private $_track;
|
||||
private $_input;
|
||||
|
||||
function __construct($trackId, $input)
|
||||
public function __construct($trackId, $input)
|
||||
{
|
||||
$this->_trackId = $trackId;
|
||||
$this->_track = Track::find($trackId);
|
||||
|
|
|
@ -39,7 +39,7 @@ class MergeAccountsCommand extends CommandBase
|
|||
private $sourceAccount;
|
||||
private $destinationAccount;
|
||||
|
||||
function __construct(User $sourceAccount, User $destinationAccount)
|
||||
public function __construct(User $sourceAccount, User $destinationAccount)
|
||||
{
|
||||
$this->sourceAccount = $sourceAccount;
|
||||
$this->destinationAccount = $destinationAccount;
|
||||
|
|
|
@ -33,7 +33,7 @@ class SaveAccountSettingsCommand extends CommandBase
|
|||
private $_user;
|
||||
private $_current;
|
||||
|
||||
function __construct($input, $slug)
|
||||
public function __construct($input, $slug)
|
||||
{
|
||||
$this->_input = $input;
|
||||
$this->_slug = $slug;
|
||||
|
|
|
@ -34,7 +34,7 @@ class ToggleFavouriteCommand extends CommandBase
|
|||
private $_resourceType;
|
||||
private $_resourceId;
|
||||
|
||||
function __construct($resourceType, $resourceId)
|
||||
public function __construct($resourceType, $resourceId)
|
||||
{
|
||||
$this->_resourceId = $resourceId;
|
||||
$this->_resourceType = $resourceType;
|
||||
|
|
|
@ -30,7 +30,7 @@ class ToggleFollowingCommand extends CommandBase
|
|||
private $_resourceType;
|
||||
private $_resourceId;
|
||||
|
||||
function __construct($resourceType, $resourceId)
|
||||
public function __construct($resourceType, $resourceId)
|
||||
{
|
||||
$this->_resourceId = $resourceId;
|
||||
$this->_resourceType = $resourceType;
|
||||
|
|
|
@ -41,7 +41,6 @@ class BootstrapLocalEnvironment extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -48,7 +48,6 @@ class FixMLPMAImages extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -58,7 +58,6 @@ class MergeAccounts extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -44,7 +44,6 @@ class PoniverseApiSetup extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -42,7 +42,6 @@ class RebuildArtists extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -47,7 +47,6 @@ class RebuildSearchIndex extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -49,7 +49,6 @@ class RebuildTrack extends Command
|
|||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
|
@ -49,7 +49,7 @@ class PlaylistsController extends ApiControllerBase
|
|||
|
||||
public function postDelete($id)
|
||||
{
|
||||
return $this->execute(new DeletePlaylistCommand($id, Input::all()));
|
||||
return $this->execute(new DeletePlaylistCommand($id));
|
||||
}
|
||||
|
||||
public function postAddTrack($id)
|
||||
|
|
|
@ -137,8 +137,6 @@ class TracksController extends ApiControllerBase
|
|||
$page = Input::get('page');
|
||||
}
|
||||
|
||||
$query = null;
|
||||
|
||||
if ($all) {
|
||||
$query = Track::summary()
|
||||
->userDetails()
|
||||
|
|
|
@ -60,7 +60,6 @@ class DisabledAccountCheck
|
|||
&& !($request->getMethod() === 'POST' && $request->getRequestUri() == '/auth/logout')
|
||||
) {
|
||||
$this->auth->logout();
|
||||
// return Response::view('home.account-disabled', ['username' => $this->auth->user()->username], 403);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
|
|
@ -35,8 +35,7 @@ class RedirectIfAuthenticated
|
|||
/**
|
||||
* Create a new filter instance.
|
||||
*
|
||||
* @param Guard $auth
|
||||
* @return void
|
||||
* @param Guard $auth
|
||||
*/
|
||||
public function __construct(Guard $auth)
|
||||
{
|
||||
|
|
|
@ -132,9 +132,6 @@ Route::group(['prefix' => 'api/web'], function() {
|
|||
Route::post('/follow/toggle', 'Api\Web\FollowController@postToggle');
|
||||
|
||||
Route::post('/dashboard/read-news', 'Api\Web\DashboardController@postReadNews');
|
||||
});
|
||||
|
||||
Route::group(['middleware' => 'auth'], function() {
|
||||
Route::get('/account/settings/{slug}', 'Api\Web\AccountController@getSettings');
|
||||
Route::get('/notifications', 'Api\Web\NotificationsController@getNotifications');
|
||||
Route::put('/notifications/mark-as-read', 'Api\Web\NotificationsController@putMarkAsRead');
|
||||
|
@ -142,7 +139,7 @@ Route::group(['prefix' => 'api/web'], function() {
|
|||
Route::get('/tracks/owned', 'Api\Web\TracksController@getOwned');
|
||||
Route::get('/tracks/edit/{id}', 'Api\Web\TracksController@getEdit');
|
||||
|
||||
Route::get('/users/{userId}', 'Api\Web\AccountController@getUser');//->where('userId', '\d+');
|
||||
Route::get('/users/{userId}', 'Api\Web\AccountController@getUser')->where('userId', '\d+');
|
||||
Route::get('/users/{userId}/albums', 'Api\Web\AlbumsController@getOwned')->where('id', '\d+');
|
||||
Route::get('/users/{userId}/images', 'Api\Web\ImagesController@getOwned')->where('id', '\d+');
|
||||
|
||||
|
@ -210,6 +207,4 @@ Route::get('/', 'HomeController@getIndex');
|
|||
Route::group(['domain' => 'api.pony.fm'], function() {
|
||||
Route::get('tracks/latest', ['uses' => 'Api\Mobile\TracksController@latest']);
|
||||
Route::get('tracks/popular', [ 'uses' => 'Api\Mobile\TracksController@popular']);
|
||||
/* Route::get('tracks/id', [ 'uses' => 'Api\Mobile\TracksController@track']);
|
||||
Route::get('user', ['uses' => 'Api\Mobile\UserController@user']);*/
|
||||
});
|
||||
|
|
|
@ -98,27 +98,27 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser');
|
||||
return $this->hasMany(ResourceUser::class);
|
||||
}
|
||||
|
||||
public function favourites():HasMany
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Favourite');
|
||||
return $this->hasMany(Favourite::class);
|
||||
}
|
||||
|
||||
public function cover()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Image');
|
||||
return $this->belongsTo(Image::class);
|
||||
}
|
||||
|
||||
public function tracks()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Track')->orderBy('track_number', 'asc');
|
||||
return $this->hasMany(Track::class)->orderBy('track_number', 'asc');
|
||||
}
|
||||
|
||||
public function trackFiles() {
|
||||
|
@ -127,7 +127,7 @@ class Album extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function comments():HasMany
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Comment')->orderBy('created_at', 'desc');
|
||||
return $this->hasMany(Comment::class)->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function activities():MorphMany {
|
||||
|
|
|
@ -60,27 +60,27 @@ class Comment extends Model
|
|||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function track()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Track');
|
||||
return $this->belongsTo(Track::class);
|
||||
}
|
||||
|
||||
public function album()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Album');
|
||||
return $this->belongsTo(Album::class);
|
||||
}
|
||||
|
||||
public function playlist()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Playlist');
|
||||
return $this->belongsTo(Playlist::class);
|
||||
}
|
||||
|
||||
public function profile()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User', 'profile_id');
|
||||
return $this->belongsTo(User::class, 'profile_id');
|
||||
}
|
||||
|
||||
public function activities():MorphMany
|
||||
|
|
|
@ -51,22 +51,22 @@ class Favourite extends Model
|
|||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function track()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Track');
|
||||
return $this->belongsTo(Track::class);
|
||||
}
|
||||
|
||||
public function album()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Album');
|
||||
return $this->belongsTo(Album::class);
|
||||
}
|
||||
|
||||
public function playlist()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Playlist');
|
||||
return $this->belongsTo(Playlist::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -39,11 +39,11 @@ class PinnedPlaylist extends Model
|
|||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function playlist()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Playlist');
|
||||
return $this->belongsTo(Playlist::class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
public function tracks()
|
||||
{
|
||||
return $this
|
||||
->belongsToMany('Poniverse\Ponyfm\Models\Track')
|
||||
->belongsToMany(Track::class)
|
||||
->withPivot('position')
|
||||
->withTimestamps()
|
||||
->orderBy('position', 'asc');
|
||||
|
@ -215,17 +215,17 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser');
|
||||
return $this->hasMany(ResourceUser::class);
|
||||
}
|
||||
|
||||
public function comments():HasMany
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Comment')->orderBy('created_at', 'desc');
|
||||
return $this->hasMany(Comment::class)->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function pins()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\PinnedPlaylist');
|
||||
return $this->hasMany(PinnedPlaylist::class);
|
||||
}
|
||||
|
||||
public function favourites():HasMany {
|
||||
|
@ -234,7 +234,7 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function activities():MorphMany {
|
||||
|
|
|
@ -486,52 +486,52 @@ class Track extends Model implements Searchable, Commentable, Favouritable
|
|||
|
||||
public function genre()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Genre');
|
||||
return $this->belongsTo(Genre::class);
|
||||
}
|
||||
|
||||
public function trackType()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\TrackType', 'track_type_id');
|
||||
return $this->belongsTo(TrackType::class, 'track_type_id');
|
||||
}
|
||||
|
||||
public function comments():HasMany
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Comment')->orderBy('created_at', 'desc');
|
||||
return $this->hasMany(Comment::class)->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function favourites():HasMany
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Favourite');
|
||||
return $this->hasMany(Favourite::class);
|
||||
}
|
||||
|
||||
public function cover()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Image');
|
||||
return $this->belongsTo(Image::class);
|
||||
}
|
||||
|
||||
public function showSongs()
|
||||
{
|
||||
return $this->belongsToMany('Poniverse\Ponyfm\Models\ShowSong');
|
||||
return $this->belongsToMany(ShowSong::class);
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser');
|
||||
return $this->hasMany(ResourceUser::class);
|
||||
}
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\User');
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function album()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Album');
|
||||
return $this->belongsTo(Album::class);
|
||||
}
|
||||
|
||||
public function trackFiles()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\TrackFile');
|
||||
return $this->hasMany(TrackFile::class);
|
||||
}
|
||||
|
||||
public function notifications()
|
||||
|
|
|
@ -153,7 +153,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||
|
||||
$user->username = $username;
|
||||
$user->display_name = $displayName;
|
||||
$user->slug = static::getUniqueSlugForName($displayName);
|
||||
$user->slug = self::getUniqueSlugForName($displayName);
|
||||
$user->email = $email;
|
||||
$user->uses_gravatar = true;
|
||||
$user->save();
|
||||
|
@ -164,12 +164,12 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||
|
||||
public function avatar()
|
||||
{
|
||||
return $this->belongsTo('Poniverse\Ponyfm\Models\Image');
|
||||
return $this->belongsTo(Image::class);
|
||||
}
|
||||
|
||||
public function users()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\ResourceUser', 'artist_id');
|
||||
return $this->hasMany(ResourceUser::class, 'artist_id');
|
||||
}
|
||||
|
||||
public function followers()
|
||||
|
@ -184,12 +184,12 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
|
|||
|
||||
public function comments():HasMany
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Comment', 'profile_id')->orderBy('created_at', 'desc');
|
||||
return $this->hasMany(Comment::class, 'profile_id')->orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
public function tracks()
|
||||
{
|
||||
return $this->hasMany('Poniverse\Ponyfm\Models\Track', 'user_id');
|
||||
return $this->hasMany(Track::class, 'user_id');
|
||||
}
|
||||
|
||||
public function notifications()
|
||||
|
|
|
@ -35,13 +35,13 @@ class PlaylistDownloader
|
|||
*/
|
||||
private $_format;
|
||||
|
||||
function __construct($playlist, $format)
|
||||
public function __construct($playlist, $format)
|
||||
{
|
||||
$this->_playlist = $playlist;
|
||||
$this->_format = $format;
|
||||
}
|
||||
|
||||
function download()
|
||||
public function download()
|
||||
{
|
||||
$zip = new ZipStream($this->_playlist->user->display_name.' - '.$this->_playlist->title.'.zip');
|
||||
$zip->setComment(
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
{{--
|
||||
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/>.
|
||||
--}}<html>
|
||||
<head>
|
||||
<title>Account disabled :: Pony.fm</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
width: 400px;
|
||||
margin: 2em auto;
|
||||
}
|
||||
|
||||
button {
|
||||
font-size: 20px;
|
||||
padding: 0.4em;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Account disabled</h1>
|
||||
<p>Your Pony.fm account, {{ $username }}, has been disabled.</p>
|
||||
<p>If you believe this to be in error,
|
||||
contact <a href="mailto:feld0@pony.fm" target="_blank">feld0@pony.fm</a>.</p>
|
||||
<p><form action="/auth/logout" method="POST">
|
||||
<button>Log out</button>
|
||||
{{ csrf_field() }}
|
||||
</form></p>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue