diff --git a/app/Commands/EditTrackCommand.php b/app/Commands/EditTrackCommand.php index 27c1fcf7..3efb286a 100644 --- a/app/Commands/EditTrackCommand.php +++ b/app/Commands/EditTrackCommand.php @@ -27,6 +27,7 @@ use Poniverse\Ponyfm\Models\Image; use Poniverse\Ponyfm\Models\Track; use Poniverse\Ponyfm\Models\TrackType; use Poniverse\Ponyfm\Models\User; +use Poniverse\Ponyfm\Models\Playlist; use DB; class EditTrackCommand extends CommandBase @@ -136,7 +137,7 @@ class EditTrackCommand extends CommandBase DB::table('tracks')->whereUserId($track->user_id)->update(['is_latest' => false]); $track->is_latest = true; - + Notification::publishedNewTrack($track); } @@ -177,6 +178,22 @@ class EditTrackCommand extends CommandBase ]); } + if (isset($this->_input['hwc_submit']) && new \DateTime() < new \DateTime("2016-12-18 00:00:00")) { + $playlist = Playlist::where('user_id', 22549)->first(); + + if ($this->_input['hwc_submit'] === true) { + if (!$playlist->tracks()->get()->contains($track)) { + $songIndex = $playlist->trackCount() + 1; + $playlist->tracks()->attach($track, ['position' => $songIndex]); + $playlist->touch(); + + Playlist::where('id', $playlist->id)->update([ + 'track_count' => DB::raw('(SELECT COUNT(id) FROM playlist_track WHERE playlist_id = '.$playlist->id.')') + ]); + } + } + } + return CommandResponse::succeed(['real_cover_url' => $track->getCoverUrl(Image::NORMAL)]); } diff --git a/app/Console/Commands/MigrateEncryption.php b/app/Console/Commands/MigrateEncryption.php new file mode 100644 index 00000000..6f901af1 --- /dev/null +++ b/app/Console/Commands/MigrateEncryption.php @@ -0,0 +1,58 @@ +laravel['config']['app.mcryptKey']; + $cipher = $this->laravel['config']['app.mcryptCipher']; + + $legacy = new McryptEncrypter($key, $cipher); + + $caches = DB::select('SELECT * FROM cache'); + + foreach ($caches as $cache) { + $newValue = encrypt( + $legacy->decrypt($cache->value) + ); + + DB::update('UPDATE cache SET value = ? WHERE key = ?', [$cache->key, $newValue]); + + $this->info("Updated {$cache->key}"); + } + } +} diff --git a/app/Models/Track.php b/app/Models/Track.php index 30c8c3fe..ca798fe4 100644 --- a/app/Models/Track.php +++ b/app/Models/Track.php @@ -533,6 +533,9 @@ class Track extends Model implements Searchable, Commentable, Favouritable $returnValue['license_id'] = $track->license_id != null ? $track->license_id : 3; $returnValue['username'] = User::whereId($track->user_id)->first()->username; + // Seasonal + $returnValue['hwc_submit'] = Playlist::where('user_id', 22549)->first()->tracks()->get()->contains($track); + return $returnValue; } @@ -731,7 +734,7 @@ class Track extends Model implements Searchable, Commentable, Favouritable { return $this->getMasterTrackFile()->isLossy(); } - + public function getCoverUrl($type = Image::NORMAL) { if (!$this->hasCover()) { diff --git a/public/templates/directives/track-editor.html b/public/templates/directives/track-editor.html index b7eb6286..061fb2d5 100644 --- a/public/templates/directives/track-editor.html +++ b/public/templates/directives/track-editor.html @@ -99,15 +99,18 @@
This contest is open to anyone with a Poniverse.net user account “Poniverse account”. Entrants are required produce an original song or remix of a song from My Little Pony: Friendship is Magic based around the theme of “Hearth’s Warming” (Christmas).This contest is open worldwide to anyone over the age of 18 and void where prohibited by law. Members of Poniverse are allowed to enter this contest with the exception of those who are directly connected with the administration or development of Pony.fm and/or administration or judging of this contest.
+ + +By submitting a song to this contest on the Pony.fm website, the entrant is indicating their agreement to these terms and conditions and agree to be fully bound by these rules
+ + +This contest opens for submissions on 21st of November 2016, the contest will stop accepting submissions on 18th of December 2016. All times for this contest will be in GMT.
+ + +To enter the contest, entrants must upload a song to the Pony.fm website and enable the “Submit to Hearth’s Warming Contest” checkbox when publishing their song. Upon doing this, the entrant is agreeing to the rules and terms laid out here. Entrants that do not follow the rules may be disqualified at the discretion of Poniverse. An entrant can submit an unlimited number of entries. The amount of entries submitted does not automatically increase the odds of winning. The judges will also create a playlist of the majority of entries submitted to the contest for featuring on Pony.fm. Entering the contest does not result in a guaranteed place on this list. Judges will add most of the entries submitted, with the exception of: entries that break the rules and entries that are deemed to be of poor quality. If an entrant submits multiple entries, they can only have a maximum of three entries on the contest playlist.
+ + +There will be three prize winners picked from this contest. Winners are picked by group of Poniverse members. The group of Poniverse members who will judge this entries will be chosen by the Poniverse member, “Logic”. Judges will award up to three winners. These winners will be picked based on the quality of the entries as perceived by the judges. The winning entrants, as chosen by judges, are final unless it is later found that one or more of the winners have broken the rules. Winners will be announced some time after the contest has closed. Poniverse reserves the right to redraw winners at any point if there is suspicion or proof that a winner has broken the terms.
+ + +The first place prize winner will receive a 50 USD Amazon.com gift voucher code. Second place will receive a 25 USD Amazon.com gift voucher code. Third place will recieve a 10 USD Amazon.com gift voucher code. The three winners will also have their entries featured on the Pony.fm homepage for 1 week after the winners are announced. Prizes are nontransferable. The winner must have a valid Poniverse.net account with a valid and current email registered with that account. Poniverse will attempt to contact the winner upon winning, if Poniverse does not receive a response within a reasonable amount of time (determined by Poniverse), the winners may be redrawn. If the winner is not living in the United States of America when they win the contest, Poniverse will attempt to offer an Amazon gift voucher in their resident country with an approximate equal value in their resident country’s currency. If Poniverse cannot provide an Amazon gift voucher to the winner for any reason, Poniverse will seek alternative prize offerings. If an alternative prize cannot be agreed upon within a reasonable amount of time, Poniverse will redraw the winners. Poniverse does not accept responsibility for the prize being lost or stolen.
+ + +Upon submitting an entry to the contest, entrants are confirming that their entry is their own original work or their own original remix of a song from My Little Pony: Friendship is Magic based around the theme of “Hearth’s Warming” (Christmas). Remixes of songs from the show will be reviewed for originality. Poniverse may choose to disqualify some remixes that sound too similar to the original song. Entries produced by multiple people may be submitted if all parties have agreed on its submission. The entrant agrees, upon entering their song in the contest, they have the right to submit the song. Poniverse will disqualify tracks that are in breach of copyright law.
+