mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-28 23:57:59 +01:00
Merge branch 'development'
This commit is contained in:
commit
baad99a26c
22 changed files with 259 additions and 34 deletions
94
app/controllers/Api/V1/TracksController.php
Normal file
94
app/controllers/Api/V1/TracksController.php
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Api\V1;
|
||||||
|
|
||||||
|
use Commands\DeleteTrackCommand;
|
||||||
|
use Commands\EditTrackCommand;
|
||||||
|
use Commands\UploadTrackCommand;
|
||||||
|
use Cover;
|
||||||
|
use Entities\Favourite;
|
||||||
|
use Entities\Image;
|
||||||
|
use Entities\ResourceLogItem;
|
||||||
|
use Entities\ResourceUser;
|
||||||
|
use Entities\Track;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Input;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
use Illuminate\Support\Facades\Response;
|
||||||
|
|
||||||
|
class TracksController extends \ApiControllerBase {
|
||||||
|
public function getTrackRadioDetails($hash) {
|
||||||
|
$track = Track
|
||||||
|
::with('user', 'album', 'user.avatar', 'cover', 'comments', 'genre')
|
||||||
|
->published()
|
||||||
|
->whereHash($hash)->first();
|
||||||
|
|
||||||
|
if (!$track)
|
||||||
|
return Response::json(['message' => 'Track not found.'], 403);
|
||||||
|
|
||||||
|
$comments = [];
|
||||||
|
foreach ($track->comments as $comment) {
|
||||||
|
$comments[] = [
|
||||||
|
'id' => $comment->id,
|
||||||
|
'created_at' => $comment->created_at,
|
||||||
|
'content' => $comment->content,
|
||||||
|
'user' => [
|
||||||
|
'name' => $comment->user->display_name,
|
||||||
|
'id' => $comment->user->id,
|
||||||
|
'url' => $comment->user->url,
|
||||||
|
'avatars' => [
|
||||||
|
'normal' => $comment->user->getAvatarUrl(Image::NORMAL),
|
||||||
|
'thumbnail' => $comment->user->getAvatarUrl(Image::THUMBNAIL),
|
||||||
|
'small' => $comment->user->getAvatarUrl(Image::SMALL),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response::json([
|
||||||
|
'id' => $track->id,
|
||||||
|
'title' => $track->title,
|
||||||
|
'description' => $track->description,
|
||||||
|
'lyrics' => $track->lyrics,
|
||||||
|
'user' => [
|
||||||
|
'id' => $track->user->id,
|
||||||
|
'name' => $track->user->display_name,
|
||||||
|
'url' => $track->user->url,
|
||||||
|
'avatars' => [
|
||||||
|
'thumbnail' => $track->user->getAvatarUrl(Image::THUMBNAIL),
|
||||||
|
'small' => $track->user->getAvatarUrl(Image::SMALL),
|
||||||
|
'normal' => $track->user->getAvatarUrl(Image::NORMAL)
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'stats' => [
|
||||||
|
'views' => $track->view_count,
|
||||||
|
'plays' => $track->play_count,
|
||||||
|
'downloads' => $track->download_count,
|
||||||
|
'comments' => $track->comment_count,
|
||||||
|
'favourites' => $track->favourite_count
|
||||||
|
],
|
||||||
|
'url' => $track->url,
|
||||||
|
'is_vocal' => !!$track->is_vocal,
|
||||||
|
'is_explicit' => !!$track->is_explicit,
|
||||||
|
'is_downloadable' => !!$track->is_downloadable,
|
||||||
|
'published_at' => $track->published_at,
|
||||||
|
'duration' => $track->duration,
|
||||||
|
'genre' => $track->genre != null
|
||||||
|
?
|
||||||
|
[
|
||||||
|
'id' => $track->genre->id,
|
||||||
|
'name' => $track->genre->name
|
||||||
|
] : null,
|
||||||
|
'type' => [
|
||||||
|
'id' => $track->track_type->id,
|
||||||
|
'name' => $track->track_type->title
|
||||||
|
],
|
||||||
|
'covers' => [
|
||||||
|
'thumbnail' => $track->getCoverUrl(Image::THUMBNAIL),
|
||||||
|
'small' => $track->getCoverUrl(Image::SMALL),
|
||||||
|
'normal' => $track->getCoverUrl(Image::NORMAL)
|
||||||
|
],
|
||||||
|
'comments' => $comments
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
}
|
|
@ -57,7 +57,7 @@
|
||||||
if (!$user)
|
if (!$user)
|
||||||
App::abort(404);
|
App::abort(404);
|
||||||
|
|
||||||
$query = Track::summary()->with('genre', 'cover', 'user')->userDetails()->whereUserId($user->id)->whereNotNull('published_at');
|
$query = Track::summary()->published()->listed()->explicitFilter()->with('genre', 'cover', 'user')->userDetails()->whereUserId($user->id)->whereNotNull('published_at');
|
||||||
$tracks = [];
|
$tracks = [];
|
||||||
$singles = [];
|
$singles = [];
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
if (!$user)
|
if (!$user)
|
||||||
App::abort(404);
|
App::abort(404);
|
||||||
|
|
||||||
$trackQuery = Track::summary()->with('genre', 'cover', 'user')->userDetails()->whereUserId($user->id)->whereNotNull('published_at')->orderBy('created_at', 'desc')->take(20);
|
$trackQuery = Track::summary()->published()->explicitFilter()->listed()->with('genre', 'cover', 'user')->userDetails()->whereUserId($user->id)->whereNotNull('published_at')->orderBy('created_at', 'desc')->take(20);
|
||||||
$latestTracks = [];
|
$latestTracks = [];
|
||||||
|
|
||||||
foreach ($trackQuery->get() as $track) {
|
foreach ($trackQuery->get() as $track) {
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
$recentQuery = Track::summary()
|
$recentQuery = Track::summary()
|
||||||
->with(['genre', 'user', 'cover', 'user.avatar'])
|
->with(['genre', 'user', 'cover', 'user.avatar'])
|
||||||
->whereIsLatest(true)
|
->whereIsLatest(true)
|
||||||
|
->listed()
|
||||||
->userDetails()
|
->userDetails()
|
||||||
->explicitFilter()
|
->explicitFilter()
|
||||||
->published()
|
->published()
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
|
|
||||||
$query = Track::summary()
|
$query = Track::summary()
|
||||||
->userDetails()
|
->userDetails()
|
||||||
|
->listed()
|
||||||
->explicitFilter()
|
->explicitFilter()
|
||||||
->published()
|
->published()
|
||||||
->with('user', 'genre', 'cover', 'album', 'album.user');
|
->with('user', 'genre', 'cover', 'album', 'album.user');
|
||||||
|
@ -64,7 +65,7 @@
|
||||||
$tracks = [];
|
$tracks = [];
|
||||||
$ids = [];
|
$ids = [];
|
||||||
|
|
||||||
foreach ($query->get() as $track) {
|
foreach ($query->get(['tracks.*']) as $track) {
|
||||||
$tracks[] = Track::mapPublicTrackSummary($track);
|
$tracks[] = Track::mapPublicTrackSummary($track);
|
||||||
$ids[] = $track->id;
|
$ids[] = $track->id;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +94,6 @@
|
||||||
return Response::json(Track::mapPrivateTrackShow($track), 200);
|
return Response::json(Track::mapPrivateTrackShow($track), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function applyFilters($query) {
|
private function applyFilters($query) {
|
||||||
if (Input::has('order')) {
|
if (Input::has('order')) {
|
||||||
$order = \Input::get('order');
|
$order = \Input::get('order');
|
||||||
|
@ -127,7 +127,6 @@
|
||||||
$join->on('tracks.id', '=', 'show_song_track.track_id');
|
$join->on('tracks.id', '=', 'show_song_track.track_id');
|
||||||
});
|
});
|
||||||
$query->whereIn('show_song_track.show_song_id', Input::get('songs'));
|
$query->whereIn('show_song_track.show_song_id', Input::get('songs'));
|
||||||
$query->select('tracks.*');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
||||||
} else {
|
} else {
|
||||||
$response->header('X-Accel-Redirect', $filename);
|
$response->header('X-Accel-Redirect', $filename);
|
||||||
$response->header('Content-Disposition', 'attachment; filename=' . $track->getDownloadFilenameFor($formatName));
|
$response->header('Content-Disposition', 'attachment; filename="' . $track->getDownloadFilenameFor($formatName) . '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
$time = gmdate(filemtime($filename));
|
$time = gmdate(filemtime($filename));
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Entities\Track;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateTrackHashes extends Migration {
|
||||||
|
public function up() {
|
||||||
|
Schema::table('tracks', function($table) {
|
||||||
|
$table->string('hash', 32)->notNullable()->indexed();
|
||||||
|
});
|
||||||
|
|
||||||
|
foreach (Track::with('user')->get() as $track) {
|
||||||
|
$track->updateHash();
|
||||||
|
$track->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::table('tracks', function($table) {
|
||||||
|
$table->dropColumn('hash');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class TrackIsListed extends Migration {
|
||||||
|
public function up() {
|
||||||
|
Schema::table('tracks', function($table) {
|
||||||
|
$table->boolean('is_listed')->notNullable()->indexed();
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::update('
|
||||||
|
UPDATE
|
||||||
|
tracks
|
||||||
|
SET
|
||||||
|
is_listed = true');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::table('tracks', function($table) {
|
||||||
|
$table->dropColumn('is_listed');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Helpers {
|
class Helpers {
|
||||||
|
/**
|
||||||
|
* Removes whitespace and special characters from a string
|
||||||
|
* and sets all characters to lower case.
|
||||||
|
*/
|
||||||
|
public static function sanitizeInputForHashing($value) {
|
||||||
|
$value = preg_replace('/[^A-Za-z0-9]/', '', $value);
|
||||||
|
return strtolower($value);
|
||||||
|
}
|
||||||
|
|
||||||
public static function template($template) {
|
public static function template($template) {
|
||||||
echo file_get_contents('templates/' . $template);
|
echo file_get_contents('templates/' . $template);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
$track->track_type_id = $this->_input['track_type_id'];
|
$track->track_type_id = $this->_input['track_type_id'];
|
||||||
$track->is_explicit = $this->_input['is_explicit'] == 'true';
|
$track->is_explicit = $this->_input['is_explicit'] == 'true';
|
||||||
$track->is_downloadable = $this->_input['is_downloadable'] == 'true';
|
$track->is_downloadable = $this->_input['is_downloadable'] == 'true';
|
||||||
|
$track->is_listed = $this->_input['is_listed'] == 'true';
|
||||||
$track->is_vocal = $isVocal;
|
$track->is_vocal = $isVocal;
|
||||||
|
|
||||||
if (isset($this->_input['album_id']) && strlen(trim($this->_input['album_id']))) {
|
if (isset($this->_input['album_id']) && strlen(trim($this->_input['album_id']))) {
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
$track->user_id = $user->id;
|
$track->user_id = $user->id;
|
||||||
$track->title = pathinfo($trackFile->getClientOriginalName(), PATHINFO_FILENAME);
|
$track->title = pathinfo($trackFile->getClientOriginalName(), PATHINFO_FILENAME);
|
||||||
$track->duration = $audio->getDuration();
|
$track->duration = $audio->getDuration();
|
||||||
|
$track->is_listed = true;
|
||||||
|
|
||||||
$track->save();
|
$track->save();
|
||||||
|
|
||||||
|
|
|
@ -92,6 +92,7 @@
|
||||||
|
|
||||||
public function ensureDirectoryExists() {
|
public function ensureDirectoryExists() {
|
||||||
$destination = $this->getDirectory();
|
$destination = $this->getDirectory();
|
||||||
|
umask(0);
|
||||||
|
|
||||||
if (!is_dir($destination))
|
if (!is_dir($destination))
|
||||||
mkdir($destination, 777, true);
|
mkdir($destination, 777, true);
|
||||||
|
|
|
@ -19,7 +19,9 @@
|
||||||
class Track extends \Eloquent {
|
class Track extends \Eloquent {
|
||||||
protected $softDelete = true;
|
protected $softDelete = true;
|
||||||
|
|
||||||
use SlugTrait;
|
use SlugTrait {
|
||||||
|
SlugTrait::setTitleAttribute as setTitleAttributeSlug;
|
||||||
|
}
|
||||||
|
|
||||||
public static $Formats = [
|
public static $Formats = [
|
||||||
'FLAC' => ['index' => 0, 'extension' => 'flac', 'tag_format' => 'metaflac', 'tag_method' => 'updateTagsWithGetId3', 'mime_type' => 'audio/flac', 'command' => 'ffmpeg 2>&1 -y -i {$source} -acodec flac -aq 8 -f flac {$target}'],
|
'FLAC' => ['index' => 0, 'extension' => 'flac', 'tag_format' => 'metaflac', 'tag_method' => 'updateTagsWithGetId3', 'mime_type' => 'audio/flac', 'command' => 'ffmpeg 2>&1 -y -i {$source} -acodec flac -aq 8 -f flac {$target}'],
|
||||||
|
@ -45,6 +47,10 @@
|
||||||
$query->whereNotNull('published_at');
|
$query->whereNotNull('published_at');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scopeListed($query) {
|
||||||
|
$query->whereIsListed(true);
|
||||||
|
}
|
||||||
|
|
||||||
public function scopeExplicitFilter($query) {
|
public function scopeExplicitFilter($query) {
|
||||||
if (!Auth::check() || !Auth::user()->can_see_explicit_content)
|
if (!Auth::check() || !Auth::user()->can_see_explicit_content)
|
||||||
$query->whereIsExplicit(false);
|
$query->whereIsExplicit(false);
|
||||||
|
@ -58,6 +64,7 @@
|
||||||
$trackIds = Cache::remember('popular_tracks' . $count . '-' . ($allowExplicit ? 'explicit' : 'safe'), 5, function() use ($allowExplicit, $count) {
|
$trackIds = Cache::remember('popular_tracks' . $count . '-' . ($allowExplicit ? 'explicit' : 'safe'), 5, function() use ($allowExplicit, $count) {
|
||||||
$query = static
|
$query = static
|
||||||
::published()
|
::published()
|
||||||
|
->listed()
|
||||||
->join(DB::raw('
|
->join(DB::raw('
|
||||||
( SELECT `track_id`, `created_at`
|
( SELECT `track_id`, `created_at`
|
||||||
FROM `resource_log_items`
|
FROM `resource_log_items`
|
||||||
|
@ -247,7 +254,8 @@
|
||||||
'duration' => $track->duration,
|
'duration' => $track->duration,
|
||||||
'genre_id' => $track->genre_id,
|
'genre_id' => $track->genre_id,
|
||||||
'track_type_id' => $track->track_type_id,
|
'track_type_id' => $track->track_type_id,
|
||||||
'cover_url' => $track->getCoverUrl(Image::SMALL)
|
'cover_url' => $track->getCoverUrl(Image::SMALL),
|
||||||
|
'is_listed' => !!$track->is_listed
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,6 +265,10 @@
|
||||||
return $this->belongsTo('Entities\Genre');
|
return $this->belongsTo('Entities\Genre');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function trackType() {
|
||||||
|
return $this->belongsTo('Entities\TrackType', 'track_type_id');
|
||||||
|
}
|
||||||
|
|
||||||
public function comments(){
|
public function comments(){
|
||||||
return $this->hasMany('Entities\Comment')->orderBy('created_at', 'desc');
|
return $this->hasMany('Entities\Comment')->orderBy('created_at', 'desc');
|
||||||
}
|
}
|
||||||
|
@ -289,6 +301,11 @@
|
||||||
return date('Y', strtotime($this->release_date));
|
return date('Y', strtotime($this->release_date));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setTitleAttribute($value) {
|
||||||
|
$this->setTitleAttributeSlug($value);;
|
||||||
|
$this->updateHash();
|
||||||
|
}
|
||||||
|
|
||||||
public function getFilesize($formatName) {
|
public function getFilesize($formatName) {
|
||||||
return Cache::remember($this->getCacheKey('filesize-' . $formatName), 1440, function () use ($formatName) {
|
return Cache::remember($this->getCacheKey('filesize-' . $formatName), 1440, function () use ($formatName) {
|
||||||
$file = $this->getFileFor($formatName);
|
$file = $this->getFileFor($formatName);
|
||||||
|
@ -332,6 +349,7 @@
|
||||||
|
|
||||||
public function ensureDirectoryExists() {
|
public function ensureDirectoryExists() {
|
||||||
$destination = $this->getDirectory();
|
$destination = $this->getDirectory();
|
||||||
|
umask(0);
|
||||||
|
|
||||||
if (!is_dir($destination))
|
if (!is_dir($destination))
|
||||||
mkdir($destination, 777);
|
mkdir($destination, 777);
|
||||||
|
@ -401,6 +419,10 @@
|
||||||
return URL::to('/t' . $this->id . '/dl.' . $format['extension']);
|
return URL::to('/t' . $this->id . '/dl.' . $format['extension']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateHash() {
|
||||||
|
$this->hash = md5(Helpers::sanitizeInputForHashing($this->user->display_name) . '-' . Helpers::sanitizeInputForHashing($this->title));
|
||||||
|
}
|
||||||
|
|
||||||
public function updateTags() {
|
public function updateTags() {
|
||||||
foreach (self::$Formats as $format => $data) {
|
foreach (self::$Formats as $format => $data) {
|
||||||
$this->{$data['tag_method']}($format);
|
$this->{$data['tag_method']}($format);
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setDisplayName($value) {
|
public function setDisplayNameAttribute($value) {
|
||||||
$this->attributes['display_name'] = $value;
|
$this->attributes['display_name'] = $value;
|
||||||
$this->attributes['slug'] = Str::slug($value);
|
$this->attributes['slug'] = Str::slug($value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,11 @@
|
||||||
Route::get('p{id}', 'PlaylistsController@getShortlink')->where('id', '\d+');
|
Route::get('p{id}', 'PlaylistsController@getShortlink')->where('id', '\d+');
|
||||||
Route::get('p{id}/dl.{extension}', 'PlaylistsController@getDownload' );
|
Route::get('p{id}/dl.{extension}', 'PlaylistsController@getDownload' );
|
||||||
|
|
||||||
|
Route::group(['prefix' => 'api/v1'], function() {
|
||||||
|
Route::get('/tracks/radio-details/{hash}', 'Api\V1\TracksController@getTrackRadioDetails');
|
||||||
|
Route::post('/tracks/radio-details/{hash}', 'Api\V1\TracksController@getTrackRadioDetails');
|
||||||
|
});
|
||||||
|
|
||||||
Route::group(['prefix' => 'api/web'], function() {
|
Route::group(['prefix' => 'api/web'], function() {
|
||||||
Route::get('/taxonomies/all', 'Api\Web\TaxonomiesController@getAll');
|
Route::get('/taxonomies/all', 'Api\Web\TaxonomiesController@getAll');
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<a href="/">pony.fm</a>
|
<a href="/">pony.fm <small>(beta)</small></a>
|
||||||
<div class="now-playing">
|
<div class="now-playing">
|
||||||
@if (Auth::check())
|
@if (Auth::check())
|
||||||
<div class="user-details dropdown">
|
<div class="user-details dropdown">
|
||||||
|
|
|
@ -302,7 +302,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirect;
|
use Symfony\Component\HttpFoundation\RedirectResponse as SymfonyRedirect;
|
||||||
class Application extends Container implements HttpKernelInterface, ResponsePreparerInterface
|
class Application extends Container implements HttpKernelInterface, ResponsePreparerInterface
|
||||||
{
|
{
|
||||||
const VERSION = '4.0.6';
|
const VERSION = '4.0.7';
|
||||||
protected $booted = false;
|
protected $booted = false;
|
||||||
protected $bootingCallbacks = array();
|
protected $bootingCallbacks = array();
|
||||||
protected $bootedCallbacks = array();
|
protected $bootedCallbacks = array();
|
||||||
|
@ -949,11 +949,19 @@ class Request
|
||||||
$query = $parameters;
|
$query = $parameters;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$queryString = '';
|
||||||
if (isset($components['query'])) {
|
if (isset($components['query'])) {
|
||||||
parse_str(html_entity_decode($components['query']), $qs);
|
parse_str(html_entity_decode($components['query']), $qs);
|
||||||
|
if ($query) {
|
||||||
$query = array_replace($qs, $query);
|
$query = array_replace($qs, $query);
|
||||||
}
|
|
||||||
$queryString = http_build_query($query, '', '&');
|
$queryString = http_build_query($query, '', '&');
|
||||||
|
} else {
|
||||||
|
$query = $qs;
|
||||||
|
$queryString = $components['query'];
|
||||||
|
}
|
||||||
|
} elseif ($query) {
|
||||||
|
$queryString = http_build_query($query, '', '&');
|
||||||
|
}
|
||||||
$server['REQUEST_URI'] = $components['path'] . ('' !== $queryString ? '?' . $queryString : '');
|
$server['REQUEST_URI'] = $components['path'] . ('' !== $queryString ? '?' . $queryString : '');
|
||||||
$server['QUERY_STRING'] = $queryString;
|
$server['QUERY_STRING'] = $queryString;
|
||||||
return new static($query, $request, array(), $cookies, $files, $server, $content);
|
return new static($query, $request, array(), $cookies, $files, $server, $content);
|
||||||
|
@ -989,8 +997,11 @@ class Request
|
||||||
$dup->basePath = null;
|
$dup->basePath = null;
|
||||||
$dup->method = null;
|
$dup->method = null;
|
||||||
$dup->format = null;
|
$dup->format = null;
|
||||||
if (!$dup->get('_format')) {
|
if (!$dup->get('_format') && $this->get('_format')) {
|
||||||
$dup->setRequestFormat($this->getRequestFormat());
|
$dup->attributes->set('_format', $this->get('_format'));
|
||||||
|
}
|
||||||
|
if (!$dup->getRequestFormat(null)) {
|
||||||
|
$dup->setRequestFormat($format = $this->getRequestFormat(null));
|
||||||
}
|
}
|
||||||
return $dup;
|
return $dup;
|
||||||
}
|
}
|
||||||
|
@ -1176,6 +1187,12 @@ class Request
|
||||||
return 443;
|
return 443;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($host = $this->headers->get('HOST')) {
|
||||||
|
if (false !== ($pos = strrpos($host, ':'))) {
|
||||||
|
return intval(substr($host, $pos + 1));
|
||||||
|
}
|
||||||
|
return 'https' === $this->getScheme() ? 443 : 80;
|
||||||
|
}
|
||||||
return $this->server->get('SERVER_PORT');
|
return $this->server->get('SERVER_PORT');
|
||||||
}
|
}
|
||||||
public function getUser()
|
public function getUser()
|
||||||
|
@ -1509,14 +1526,14 @@ class Request
|
||||||
return rtrim($prefix, '/');
|
return rtrim($prefix, '/');
|
||||||
}
|
}
|
||||||
$truncatedRequestUri = $requestUri;
|
$truncatedRequestUri = $requestUri;
|
||||||
if (($pos = strpos($requestUri, '?')) !== false) {
|
if (false !== ($pos = strpos($requestUri, '?'))) {
|
||||||
$truncatedRequestUri = substr($requestUri, 0, $pos);
|
$truncatedRequestUri = substr($requestUri, 0, $pos);
|
||||||
}
|
}
|
||||||
$basename = basename($baseUrl);
|
$basename = basename($baseUrl);
|
||||||
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) {
|
if (empty($basename) || !strpos(rawurldecode($truncatedRequestUri), $basename)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
if (strlen($requestUri) >= strlen($baseUrl) && (false !== ($pos = strpos($requestUri, $baseUrl)) && $pos !== 0)) {
|
if (strlen($requestUri) >= strlen($baseUrl) && false !== ($pos = strpos($requestUri, $baseUrl)) && $pos !== 0) {
|
||||||
$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
|
$baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl));
|
||||||
}
|
}
|
||||||
return rtrim($baseUrl, '/');
|
return rtrim($baseUrl, '/');
|
||||||
|
@ -1787,15 +1804,22 @@ class ServerBag extends ParameterBag
|
||||||
} elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) {
|
} elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) {
|
||||||
$authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
|
$authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION'];
|
||||||
}
|
}
|
||||||
if (null !== $authorizationHeader && 0 === stripos($authorizationHeader, 'basic')) {
|
if (null !== $authorizationHeader) {
|
||||||
|
if (0 === stripos($authorizationHeader, 'basic')) {
|
||||||
$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)));
|
$exploded = explode(':', base64_decode(substr($authorizationHeader, 6)));
|
||||||
if (count($exploded) == 2) {
|
if (count($exploded) == 2) {
|
||||||
list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
|
list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded;
|
||||||
}
|
}
|
||||||
|
} elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && 0 === stripos($authorizationHeader, 'digest')) {
|
||||||
|
$headers['PHP_AUTH_DIGEST'] = $authorizationHeader;
|
||||||
|
$this->parameters['PHP_AUTH_DIGEST'] = $authorizationHeader;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($headers['PHP_AUTH_USER'])) {
|
if (isset($headers['PHP_AUTH_USER'])) {
|
||||||
$headers['AUTHORIZATION'] = 'Basic ' . base64_encode($headers['PHP_AUTH_USER'] . ':' . $headers['PHP_AUTH_PW']);
|
$headers['AUTHORIZATION'] = 'Basic ' . base64_encode($headers['PHP_AUTH_USER'] . ':' . $headers['PHP_AUTH_PW']);
|
||||||
|
} elseif (isset($headers['PHP_AUTH_DIGEST'])) {
|
||||||
|
$headers['AUTHORIZATION'] = $headers['PHP_AUTH_DIGEST'];
|
||||||
}
|
}
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
@ -2225,6 +2249,7 @@ class NativeSessionStorage implements SessionStorageInterface
|
||||||
} else {
|
} else {
|
||||||
session_start();
|
session_start();
|
||||||
}
|
}
|
||||||
|
$this->loadSession();
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
@ -3257,8 +3282,7 @@ class ExceptionServiceProvider extends ServiceProvider
|
||||||
}
|
}
|
||||||
protected function getResourcePath()
|
protected function getResourcePath()
|
||||||
{
|
{
|
||||||
$base = $this->app['path.base'];
|
return 'F:\\Nelson\\My Documents - Personal\\Visual Studio 2010\\Projects\\Poniverse\\spa.pony.fm\\vendor\\laravel\\framework\\src\\Illuminate\\Exception' . '/resources';
|
||||||
return $base . '/vendor/laravel/framework/src/Illuminate/Exception/resources';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace Illuminate\Routing;
|
namespace Illuminate\Routing;
|
||||||
|
@ -3611,7 +3635,7 @@ class ErrorHandler
|
||||||
if (null === ($error = error_get_last())) {
|
if (null === ($error = error_get_last())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unset($this->reservedMemory);
|
$this->reservedMemory = '';
|
||||||
$type = $error['type'];
|
$type = $error['type'];
|
||||||
if (0 === $this->level || !in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
|
if (0 === $this->level || !in_array($type, array(E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE))) {
|
||||||
return;
|
return;
|
||||||
|
@ -4218,10 +4242,6 @@ class ProviderRepository
|
||||||
$this->files->put($path, json_encode($manifest));
|
$this->files->put($path, json_encode($manifest));
|
||||||
return $manifest;
|
return $manifest;
|
||||||
}
|
}
|
||||||
protected function getManifestPath($app)
|
|
||||||
{
|
|
||||||
return $this->manifestPath;
|
|
||||||
}
|
|
||||||
protected function freshManifest(array $providers)
|
protected function freshManifest(array $providers)
|
||||||
{
|
{
|
||||||
list($eager, $deferred) = array(array(), array());
|
list($eager, $deferred) = array(array(), array());
|
||||||
|
@ -5381,6 +5401,7 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa
|
||||||
protected $appends = array();
|
protected $appends = array();
|
||||||
protected $fillable = array();
|
protected $fillable = array();
|
||||||
protected $guarded = array('*');
|
protected $guarded = array('*');
|
||||||
|
protected $dates = array();
|
||||||
protected $touches = array();
|
protected $touches = array();
|
||||||
protected $with = array();
|
protected $with = array();
|
||||||
public $exists = false;
|
public $exists = false;
|
||||||
|
@ -5853,7 +5874,7 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa
|
||||||
}
|
}
|
||||||
public function freshTimestamp()
|
public function freshTimestamp()
|
||||||
{
|
{
|
||||||
return new DateTime();
|
return new Carbon();
|
||||||
}
|
}
|
||||||
public function freshTimestampString()
|
public function freshTimestampString()
|
||||||
{
|
{
|
||||||
|
@ -6153,7 +6174,8 @@ abstract class Model implements ArrayAccess, ArrayableInterface, JsonableInterfa
|
||||||
}
|
}
|
||||||
public function getDates()
|
public function getDates()
|
||||||
{
|
{
|
||||||
return array(static::CREATED_AT, static::UPDATED_AT, static::DELETED_AT);
|
$defaults = array(static::CREATED_AT, static::UPDATED_AT, static::DELETED_AT);
|
||||||
|
return array_merge($this->dates, $defaults);
|
||||||
}
|
}
|
||||||
public function fromDateTime($value)
|
public function fromDateTime($value)
|
||||||
{
|
{
|
||||||
|
@ -6590,7 +6612,7 @@ class Store extends SymfonySession
|
||||||
}
|
}
|
||||||
protected function mergeNewFlashes(array $keys)
|
protected function mergeNewFlashes(array $keys)
|
||||||
{
|
{
|
||||||
$values = array_unique(array_merge($this->get('flash.new'), $keys));
|
$values = array_unique(array_merge($this->get('flash.new', array()), $keys));
|
||||||
$this->put('flash.new', $values);
|
$this->put('flash.new', $values);
|
||||||
}
|
}
|
||||||
protected function removeFromOldFlashData(array $keys)
|
protected function removeFromOldFlashData(array $keys)
|
||||||
|
|
|
@ -122,6 +122,7 @@ angular.module('ponyfm').controller "account-track", [
|
||||||
cover: track.cover_url
|
cover: track.cover_url
|
||||||
album_id: track.album_id
|
album_id: track.album_id
|
||||||
is_published: track.is_published
|
is_published: track.is_published
|
||||||
|
is_listed: track.is_listed
|
||||||
|
|
||||||
$scope.selectedAlbum = if track.album_id then albumsDb[track.album_id] else null
|
$scope.selectedAlbum = if track.album_id then albumsDb[track.album_id] else null
|
||||||
$scope.selectedSongs = {}
|
$scope.selectedSongs = {}
|
||||||
|
|
|
@ -3,6 +3,12 @@ window.handleResize = () ->
|
||||||
$siteBody = $ '.site-body'
|
$siteBody = $ '.site-body'
|
||||||
$siteBody.height windowHeight - $('header').height()
|
$siteBody.height windowHeight - $('header').height()
|
||||||
|
|
||||||
|
$('.dropdown-menu').each () ->
|
||||||
|
$this = $ this
|
||||||
|
newMaxHeight = windowHeight - $this.parent().offset().top - $this.parent().height() - 5
|
||||||
|
$this.css
|
||||||
|
'max-height': newMaxHeight
|
||||||
|
|
||||||
$('.stretch-to-bottom').each () ->
|
$('.stretch-to-bottom').each () ->
|
||||||
$this = $ this
|
$this = $ this
|
||||||
newHeight = windowHeight - $this.offset().top
|
newHeight = windowHeight - $this.offset().top
|
||||||
|
|
|
@ -217,6 +217,7 @@ html body {
|
||||||
html .dropdown-menu {
|
html .dropdown-menu {
|
||||||
.border-radius(0px);
|
.border-radius(0px);
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
|
overflow-y: auto;
|
||||||
|
|
||||||
> li {
|
> li {
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|
|
@ -18,7 +18,7 @@ header {
|
||||||
float: left;
|
float: left;
|
||||||
width: (@pfm-sidebar-size - 25);
|
width: (@pfm-sidebar-size - 25);
|
||||||
height: 64px;
|
height: 64px;
|
||||||
line-height: 52px;
|
line-height: 42px;
|
||||||
background: #84528A;
|
background: #84528A;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 24pt;
|
font-size: 24pt;
|
||||||
|
@ -27,12 +27,22 @@ header {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 600;
|
z-index: 600;
|
||||||
font-family: 'Josefin Sans', sans-serif;
|
font-family: 'Josefin Sans', sans-serif;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: darken(#84528A, 25%);
|
background: darken(#84528A, 25%);
|
||||||
color: #fff;
|
color: #fff;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-family: 'Arial';
|
||||||
|
font-size: 8pt;
|
||||||
|
color: #eee;
|
||||||
|
position: absolute;
|
||||||
|
top: 30px;
|
||||||
|
left: 33px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-details {
|
.user-details {
|
||||||
|
|
|
@ -91,12 +91,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="span6 form-row">
|
<div class="span4 form-row">
|
||||||
<label for="is_explicit"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_explicit" type="checkbox" ng-model="edit.is_explicit" /> Contains Explicit Content</label>
|
<label for="is_explicit"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_explicit" type="checkbox" ng-model="edit.is_explicit" /> Contains Explicit Content</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="span6 form-row">
|
<div class="span4 form-row">
|
||||||
<label for="is_downloadable"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_downloadable" type="checkbox" ng-model="edit.is_downloadable" /> Is Downloadable</label>
|
<label for="is_downloadable"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_downloadable" type="checkbox" ng-model="edit.is_downloadable" /> Is Downloadable</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="span4 form-row">
|
||||||
|
<label for="is_listed"><input ng-disabled="isSaving" ng-change="touchModel()" id="is_listed" type="checkbox" ng-model="edit.is_listed" /> Is Listed</label>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label class="strong">Choose a License:</label>
|
<label class="strong">Choose a License:</label>
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/kriswallsmith/assetic" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/kriswallsmith/assetic" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/vendor/navruzm/lmongo" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/vendor/patchwork/utf8" />
|
<excludeFolder url="file://$MODULE_DIR$/vendor/patchwork/utf8" />
|
||||||
|
@ -75,6 +76,7 @@
|
||||||
<root url="file://$MODULE_DIR$/vendor/intouch/laravel-newrelic" />
|
<root url="file://$MODULE_DIR$/vendor/intouch/laravel-newrelic" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
<root url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
<root url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
||||||
|
<root url="file://$MODULE_DIR$/vendor/navruzm/lmongo" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
<root url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
<root url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/console" />
|
<root url="file://$MODULE_DIR$/vendor/symfony/console" />
|
||||||
|
@ -115,6 +117,7 @@
|
||||||
<root url="file://$MODULE_DIR$/vendor/intouch/laravel-newrelic" />
|
<root url="file://$MODULE_DIR$/vendor/intouch/laravel-newrelic" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
<root url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
<root url="file://$MODULE_DIR$/vendor/monolog/monolog" />
|
||||||
|
<root url="file://$MODULE_DIR$/vendor/navruzm/lmongo" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
<root url="file://$MODULE_DIR$/vendor/symfony/debug" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
<root url="file://$MODULE_DIR$/vendor/symfony/finder" />
|
||||||
<root url="file://$MODULE_DIR$/vendor/symfony/console" />
|
<root url="file://$MODULE_DIR$/vendor/symfony/console" />
|
||||||
|
|
Loading…
Reference in a new issue