@@ -18,7 +18,6 @@ discard block |
||
18 | 18 | * Create a new authentication controller instance. |
19 | 19 | * |
20 | 20 | * @param \Illuminate\Contracts\Auth\Guard $auth |
21 | - * @param \Illuminate\Contracts\Auth\Registrar $registrar |
|
22 | 21 | * @return void |
23 | 22 | */ |
24 | 23 | public function __construct(Guard $auth) |
@@ -31,7 +30,7 @@ discard block |
||
31 | 30 | /** |
32 | 31 | * Show the application login form. |
33 | 32 | * |
34 | - * @return \Illuminate\Http\Response |
|
33 | + * @return \Illuminate\View\View |
|
35 | 34 | */ |
36 | 35 | public function login() |
37 | 36 | { |
@@ -42,7 +41,7 @@ discard block |
||
42 | 41 | * Handle a login request to the application. |
43 | 42 | * |
44 | 43 | * @param \Illuminate\Http\Request $request |
45 | - * @return \Illuminate\Http\Response |
|
44 | + * @return \Illuminate\Http\RedirectResponse |
|
46 | 45 | */ |
47 | 46 | public function authenticate(Request $request) |
48 | 47 | { |
@@ -67,7 +66,7 @@ discard block |
||
67 | 66 | /** |
68 | 67 | * Log the user out of the application. |
69 | 68 | * |
70 | - * @return \Illuminate\Http\Response |
|
69 | + * @return \Illuminate\Http\RedirectResponse |
|
71 | 70 | */ |
72 | 71 | public function logout() |
73 | 72 | { |
@@ -1,6 +1,5 @@ discard block |
||
1 | 1 | <?php namespace WITR\Http\Controllers; |
2 | 2 | |
3 | -use WITR\Http\Requests; |
|
4 | 3 | use WITR\Http\Requests\DJ\TicketRequest; |
5 | 4 | use WITR\Http\Controllers\Controller; |
6 | 5 | use WITR\Services\IcecastReader; |
@@ -9,8 +8,6 @@ discard block |
||
9 | 8 | use Illuminate\Contracts\Mail\Mailer; |
10 | 9 | use WITR\SystemSetting; |
11 | 10 | |
12 | -use Illuminate\Http\Request; |
|
13 | - |
|
14 | 11 | class DJController extends Controller { |
15 | 12 | |
16 | 13 | public function __construct() |
@@ -1,10 +1,6 @@ |
||
1 | 1 | <?php namespace WITR\Http\Controllers; |
2 | 2 | |
3 | -use WITR\Http\Requests; |
|
4 | 3 | use WITR\Http\Controllers\Controller; |
5 | - |
|
6 | -use Illuminate\Http\Request; |
|
7 | - |
|
8 | 4 | use WITR\TimeSlot; |
9 | 5 | use WITR\Schedule\WeeklySchedule; |
10 | 6 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | /** |
27 | 27 | * Show the application welcome screen to the user. |
28 | 28 | * |
29 | - * @return Response |
|
29 | + * @return \Illuminate\View\View |
|
30 | 30 | */ |
31 | 31 | public function index() |
32 | 32 | { |
@@ -2,10 +2,6 @@ |
||
2 | 2 | |
3 | 3 | namespace WITR\Schedule; |
4 | 4 | |
5 | -use WITR\Show; |
|
6 | -use WITR\User; |
|
7 | -use Carbon\Carbon; |
|
8 | - |
|
9 | 5 | class ScheduledShow |
10 | 6 | { |
11 | 7 |
@@ -9,163 +9,163 @@ |
||
9 | 9 | class ScheduledShow |
10 | 10 | { |
11 | 11 | |
12 | - protected $show; |
|
13 | - protected $dj; |
|
14 | - protected $startingHour; |
|
15 | - protected $endingHour; |
|
16 | - protected $id; |
|
17 | - protected $dayOfWeek; |
|
18 | - |
|
19 | - public static function fromShowAndDJ($show, $dj) |
|
20 | - { |
|
21 | - $scheduledShow = new ScheduledShow(); |
|
22 | - |
|
23 | - $scheduledShow->show = $show; |
|
24 | - $scheduledShow->dj = $dj; |
|
25 | - |
|
26 | - return $scheduledShow; |
|
27 | - } |
|
28 | - |
|
29 | - public function dj() |
|
30 | - { |
|
31 | - return $this->dj->name; |
|
32 | - } |
|
33 | - |
|
34 | - public function djId() |
|
35 | - { |
|
36 | - return $this->dj->id; |
|
37 | - } |
|
38 | - |
|
39 | - public function show() |
|
40 | - { |
|
41 | - return $this->show->name; |
|
42 | - } |
|
43 | - |
|
44 | - public function showId() |
|
45 | - { |
|
46 | - return $this->show->id; |
|
47 | - } |
|
48 | - |
|
49 | - public function djPicture() |
|
50 | - { |
|
51 | - return $this->dj->picture; |
|
52 | - } |
|
53 | - |
|
54 | - public function showPicture() |
|
55 | - { |
|
56 | - return $this->show->show_picture; |
|
57 | - } |
|
58 | - |
|
59 | - public function sliderPicture() |
|
60 | - { |
|
61 | - return $this->show->slider_picture; |
|
62 | - } |
|
63 | - |
|
64 | - public function sliderStyle() |
|
65 | - { |
|
66 | - return $this->show->style; |
|
67 | - } |
|
68 | - |
|
69 | - public function startsAt($startingHour) |
|
70 | - { |
|
71 | - $this->startingHour = $startingHour; |
|
72 | - $this->endingHour = $startingHour; |
|
73 | - $this->extendShowByHour(); |
|
74 | - } |
|
75 | - |
|
76 | - public function start() |
|
77 | - { |
|
78 | - return $this->startingHour; |
|
79 | - } |
|
80 | - |
|
81 | - public function end() |
|
82 | - { |
|
83 | - return $this->endingHour; |
|
84 | - } |
|
85 | - |
|
86 | - public function extendShowByHour() |
|
87 | - { |
|
88 | - $this->endingHour++; |
|
89 | - } |
|
90 | - |
|
91 | - public function timespan() |
|
92 | - { |
|
93 | - $suffix = $this->endingHour < 12 || $this->endingHour > 24 ? 'AM' : 'PM'; |
|
94 | - $endingHour = $this->hourAdjusted($this->endingHour); |
|
95 | - $startingHour = $this->hourAdjusted($this->startingHour); |
|
96 | - return $startingHour . ' - ' . $endingHour . ' ' . $suffix; |
|
97 | - } |
|
98 | - |
|
99 | - private function hourAdjusted($hour) |
|
100 | - { |
|
101 | - while ($hour > 12) { |
|
102 | - $hour -= 12; |
|
103 | - } |
|
104 | - return $hour; |
|
105 | - } |
|
106 | - |
|
107 | - public function airsDayOfWeek($airsDayOfWeek) |
|
108 | - { |
|
109 | - $this->dayOfWeek = $airsDayOfWeek; |
|
110 | - } |
|
111 | - |
|
112 | - public function getAirDate() |
|
113 | - { |
|
114 | - return Weekday::display($this->dayOfWeek); |
|
115 | - } |
|
116 | - |
|
117 | - public function getRelativeAirDate() |
|
118 | - { |
|
119 | - $now = ScheduleTime::now(); |
|
120 | - if ($this->dayOfWeek == $now->dayOfWeek) |
|
121 | - { |
|
122 | - return 'Today'; |
|
123 | - } |
|
124 | - else if ($this->dayOfWeek == $now->addDay()->dayOfWeek) |
|
125 | - { |
|
126 | - return 'Tomorrow'; |
|
127 | - } |
|
128 | - else |
|
129 | - { |
|
130 | - return $this->getAirDate(); |
|
131 | - } |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - public function airDayOfWeek() |
|
136 | - { |
|
137 | - return $this->dayOfWeek; |
|
138 | - } |
|
139 | - |
|
140 | - public function showDescription() |
|
141 | - { |
|
142 | - return $this->show->description; |
|
143 | - } |
|
144 | - |
|
145 | - public function setId($id) |
|
146 | - { |
|
147 | - $this->id = $id; |
|
148 | - } |
|
149 | - |
|
150 | - public function id() |
|
151 | - { |
|
152 | - return $this->id; |
|
153 | - } |
|
154 | - |
|
155 | - public function nowPlaying() |
|
156 | - { |
|
157 | - $today = ScheduleTime::now(); |
|
158 | - |
|
159 | - if ($this->airDayOfWeek() != $today->dayOfWeek()) |
|
160 | - { |
|
161 | - return false; |
|
162 | - } |
|
163 | - |
|
164 | - if ($this->startingHour > $today->hour() || $this->endingHour <= $today->hour()) |
|
165 | - { |
|
166 | - return false; |
|
167 | - } |
|
168 | - |
|
169 | - return true; |
|
170 | - } |
|
12 | + protected $show; |
|
13 | + protected $dj; |
|
14 | + protected $startingHour; |
|
15 | + protected $endingHour; |
|
16 | + protected $id; |
|
17 | + protected $dayOfWeek; |
|
18 | + |
|
19 | + public static function fromShowAndDJ($show, $dj) |
|
20 | + { |
|
21 | + $scheduledShow = new ScheduledShow(); |
|
22 | + |
|
23 | + $scheduledShow->show = $show; |
|
24 | + $scheduledShow->dj = $dj; |
|
25 | + |
|
26 | + return $scheduledShow; |
|
27 | + } |
|
28 | + |
|
29 | + public function dj() |
|
30 | + { |
|
31 | + return $this->dj->name; |
|
32 | + } |
|
33 | + |
|
34 | + public function djId() |
|
35 | + { |
|
36 | + return $this->dj->id; |
|
37 | + } |
|
38 | + |
|
39 | + public function show() |
|
40 | + { |
|
41 | + return $this->show->name; |
|
42 | + } |
|
43 | + |
|
44 | + public function showId() |
|
45 | + { |
|
46 | + return $this->show->id; |
|
47 | + } |
|
48 | + |
|
49 | + public function djPicture() |
|
50 | + { |
|
51 | + return $this->dj->picture; |
|
52 | + } |
|
53 | + |
|
54 | + public function showPicture() |
|
55 | + { |
|
56 | + return $this->show->show_picture; |
|
57 | + } |
|
58 | + |
|
59 | + public function sliderPicture() |
|
60 | + { |
|
61 | + return $this->show->slider_picture; |
|
62 | + } |
|
63 | + |
|
64 | + public function sliderStyle() |
|
65 | + { |
|
66 | + return $this->show->style; |
|
67 | + } |
|
68 | + |
|
69 | + public function startsAt($startingHour) |
|
70 | + { |
|
71 | + $this->startingHour = $startingHour; |
|
72 | + $this->endingHour = $startingHour; |
|
73 | + $this->extendShowByHour(); |
|
74 | + } |
|
75 | + |
|
76 | + public function start() |
|
77 | + { |
|
78 | + return $this->startingHour; |
|
79 | + } |
|
80 | + |
|
81 | + public function end() |
|
82 | + { |
|
83 | + return $this->endingHour; |
|
84 | + } |
|
85 | + |
|
86 | + public function extendShowByHour() |
|
87 | + { |
|
88 | + $this->endingHour++; |
|
89 | + } |
|
90 | + |
|
91 | + public function timespan() |
|
92 | + { |
|
93 | + $suffix = $this->endingHour < 12 || $this->endingHour > 24 ? 'AM' : 'PM'; |
|
94 | + $endingHour = $this->hourAdjusted($this->endingHour); |
|
95 | + $startingHour = $this->hourAdjusted($this->startingHour); |
|
96 | + return $startingHour . ' - ' . $endingHour . ' ' . $suffix; |
|
97 | + } |
|
98 | + |
|
99 | + private function hourAdjusted($hour) |
|
100 | + { |
|
101 | + while ($hour > 12) { |
|
102 | + $hour -= 12; |
|
103 | + } |
|
104 | + return $hour; |
|
105 | + } |
|
106 | + |
|
107 | + public function airsDayOfWeek($airsDayOfWeek) |
|
108 | + { |
|
109 | + $this->dayOfWeek = $airsDayOfWeek; |
|
110 | + } |
|
111 | + |
|
112 | + public function getAirDate() |
|
113 | + { |
|
114 | + return Weekday::display($this->dayOfWeek); |
|
115 | + } |
|
116 | + |
|
117 | + public function getRelativeAirDate() |
|
118 | + { |
|
119 | + $now = ScheduleTime::now(); |
|
120 | + if ($this->dayOfWeek == $now->dayOfWeek) |
|
121 | + { |
|
122 | + return 'Today'; |
|
123 | + } |
|
124 | + else if ($this->dayOfWeek == $now->addDay()->dayOfWeek) |
|
125 | + { |
|
126 | + return 'Tomorrow'; |
|
127 | + } |
|
128 | + else |
|
129 | + { |
|
130 | + return $this->getAirDate(); |
|
131 | + } |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + public function airDayOfWeek() |
|
136 | + { |
|
137 | + return $this->dayOfWeek; |
|
138 | + } |
|
139 | + |
|
140 | + public function showDescription() |
|
141 | + { |
|
142 | + return $this->show->description; |
|
143 | + } |
|
144 | + |
|
145 | + public function setId($id) |
|
146 | + { |
|
147 | + $this->id = $id; |
|
148 | + } |
|
149 | + |
|
150 | + public function id() |
|
151 | + { |
|
152 | + return $this->id; |
|
153 | + } |
|
154 | + |
|
155 | + public function nowPlaying() |
|
156 | + { |
|
157 | + $today = ScheduleTime::now(); |
|
158 | + |
|
159 | + if ($this->airDayOfWeek() != $today->dayOfWeek()) |
|
160 | + { |
|
161 | + return false; |
|
162 | + } |
|
163 | + |
|
164 | + if ($this->startingHour > $today->hour() || $this->endingHour <= $today->hour()) |
|
165 | + { |
|
166 | + return false; |
|
167 | + } |
|
168 | + |
|
169 | + return true; |
|
170 | + } |
|
171 | 171 | } |
@@ -120,12 +120,10 @@ |
||
120 | 120 | if ($this->dayOfWeek == $now->dayOfWeek) |
121 | 121 | { |
122 | 122 | return 'Today'; |
123 | - } |
|
124 | - else if ($this->dayOfWeek == $now->addDay()->dayOfWeek) |
|
123 | + } else if ($this->dayOfWeek == $now->addDay()->dayOfWeek) |
|
125 | 124 | { |
126 | 125 | return 'Tomorrow'; |
127 | - } |
|
128 | - else |
|
126 | + } else |
|
129 | 127 | { |
130 | 128 | return $this->getAirDate(); |
131 | 129 | } |
@@ -25,6 +25,9 @@ |
||
25 | 25 | return $this->mounts; |
26 | 26 | } |
27 | 27 | |
28 | + /** |
|
29 | + * @param string $studio |
|
30 | + */ |
|
28 | 31 | public function get($studio) |
29 | 32 | { |
30 | 33 | $results = new Collection; |
@@ -9,46 +9,46 @@ |
||
9 | 9 | class IcecastReader |
10 | 10 | { |
11 | 11 | |
12 | - protected $hostname; |
|
13 | - protected $credentials; |
|
14 | - protected $mounts; |
|
15 | - |
|
16 | - public function __construct($hostname, $credentials, $mounts) |
|
17 | - { |
|
18 | - $this->hostname = $hostname; |
|
19 | - $this->credentials = $credentials; |
|
20 | - $this->mounts = $mounts; |
|
21 | - } |
|
22 | - |
|
23 | - public function getMounts() |
|
24 | - { |
|
25 | - return $this->mounts; |
|
26 | - } |
|
27 | - |
|
28 | - public function get($studio) |
|
29 | - { |
|
30 | - $results = new Collection; |
|
31 | - |
|
32 | - $client = new Client(); |
|
12 | + protected $hostname; |
|
13 | + protected $credentials; |
|
14 | + protected $mounts; |
|
15 | + |
|
16 | + public function __construct($hostname, $credentials, $mounts) |
|
17 | + { |
|
18 | + $this->hostname = $hostname; |
|
19 | + $this->credentials = $credentials; |
|
20 | + $this->mounts = $mounts; |
|
21 | + } |
|
22 | + |
|
23 | + public function getMounts() |
|
24 | + { |
|
25 | + return $this->mounts; |
|
26 | + } |
|
27 | + |
|
28 | + public function get($studio) |
|
29 | + { |
|
30 | + $results = new Collection; |
|
31 | + |
|
32 | + $client = new Client(); |
|
33 | 33 | |
34 | - $listeners = IcecastListeners::forMounts($this->mounts[$studio]); |
|
35 | - foreach ($this->mounts[$studio] as $mount) |
|
36 | - { |
|
37 | - $response = $client->get($this->hostname . '/admin/listclients?mount=/'. $mount, [ |
|
38 | - 'auth' => $this->credentials |
|
39 | - ]); |
|
40 | - $xml = simplexml_load_string($response->getBody())->source->listener; |
|
41 | - foreach ($xml as $node) |
|
42 | - { |
|
43 | - $listener = new stdClass; |
|
44 | - $listener->hostname = gethostbyaddr($node->IP); |
|
45 | - $listener->minutesConnected = round($node->Connected / 60); |
|
46 | - $listener->userAgent = $node->UserAgent; |
|
47 | - $listener->mount = $mount; |
|
48 | - $listeners->push($listener); |
|
49 | - } |
|
50 | - } |
|
51 | - |
|
52 | - return $listeners; |
|
53 | - } |
|
34 | + $listeners = IcecastListeners::forMounts($this->mounts[$studio]); |
|
35 | + foreach ($this->mounts[$studio] as $mount) |
|
36 | + { |
|
37 | + $response = $client->get($this->hostname . '/admin/listclients?mount=/'. $mount, [ |
|
38 | + 'auth' => $this->credentials |
|
39 | + ]); |
|
40 | + $xml = simplexml_load_string($response->getBody())->source->listener; |
|
41 | + foreach ($xml as $node) |
|
42 | + { |
|
43 | + $listener = new stdClass; |
|
44 | + $listener->hostname = gethostbyaddr($node->IP); |
|
45 | + $listener->minutesConnected = round($node->Connected / 60); |
|
46 | + $listener->userAgent = $node->UserAgent; |
|
47 | + $listener->mount = $mount; |
|
48 | + $listeners->push($listener); |
|
49 | + } |
|
50 | + } |
|
51 | + |
|
52 | + return $listeners; |
|
53 | + } |
|
54 | 54 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $listeners = IcecastListeners::forMounts($this->mounts[$studio]); |
35 | 35 | foreach ($this->mounts[$studio] as $mount) |
36 | 36 | { |
37 | - $response = $client->get($this->hostname . '/admin/listclients?mount=/'. $mount, [ |
|
37 | + $response = $client->get($this->hostname . '/admin/listclients?mount=/' . $mount, [ |
|
38 | 38 | 'auth' => $this->credentials |
39 | 39 | ]); |
40 | 40 | $xml = simplexml_load_string($response->getBody())->source->listener; |
@@ -11,7 +11,6 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * Create a new filter instance. |
13 | 13 | * |
14 | - * @param Guard $auth |
|
15 | 14 | * @return void |
16 | 15 | */ |
17 | 16 | public function __construct($fromIp, $toIp) |
@@ -24,8 +23,7 @@ discard block |
||
24 | 23 | * Handle an incoming request. |
25 | 24 | * |
26 | 25 | * @param \Illuminate\Http\Request $request |
27 | - * @param \Closure $next |
|
28 | - * @return mixed |
|
26 | + * @return boolean |
|
29 | 27 | */ |
30 | 28 | public function inRange($request) |
31 | 29 | { |
@@ -30,7 +30,7 @@ |
||
30 | 30 | public function inRange($request) |
31 | 31 | { |
32 | 32 | $ip = $request->getClientIp(); |
33 | - if( (ip2long($this->fromIp) <= ip2long($ip)) && (ip2long($ip) <= ip2long($this->toIp))) { |
|
33 | + if ((ip2long($this->fromIp) <= ip2long($ip)) && (ip2long($ip) <= ip2long($this->toIp))) { |
|
34 | 34 | return true; |
35 | 35 | } else { |
36 | 36 | return false; |
@@ -34,7 +34,7 @@ |
||
34 | 34 | public $timestamps = false; |
35 | 35 | |
36 | 36 | /** |
37 | - * @return mixed |
|
37 | + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
38 | 38 | */ |
39 | 39 | public function role() |
40 | 40 | { |
@@ -31,24 +31,24 @@ |
||
31 | 31 | */ |
32 | 32 | protected $hidden = ['password', 'remember_token']; |
33 | 33 | |
34 | - public $timestamps = false; |
|
34 | + public $timestamps = false; |
|
35 | 35 | |
36 | 36 | /** |
37 | - * @return mixed |
|
38 | - */ |
|
39 | - public function role() |
|
40 | - { |
|
41 | - return $this->belongsTo('WITR\Role', 'user_role', 'id'); |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Does the user have a particular role? |
|
46 | - * |
|
47 | - * @param $name |
|
48 | - * @return bool |
|
49 | - */ |
|
50 | - public function hasRole($name) |
|
51 | - { |
|
52 | - return $this->role->name == $name; |
|
53 | - } |
|
37 | + * @return mixed |
|
38 | + */ |
|
39 | + public function role() |
|
40 | + { |
|
41 | + return $this->belongsTo('WITR\Role', 'user_role', 'id'); |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Does the user have a particular role? |
|
46 | + * |
|
47 | + * @param $name |
|
48 | + * @return bool |
|
49 | + */ |
|
50 | + public function hasRole($name) |
|
51 | + { |
|
52 | + return $this->role->name == $name; |
|
53 | + } |
|
54 | 54 | } |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function role() |
40 | 40 | { |
41 | - return $this->belongsTo('WITR\Role', 'user_role', 'id'); |
|
41 | + return $this->belongsTo('WITR\Role', 'user_role', 'id'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | public function handle() |
30 | 30 | { |
31 | - $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); |
|
31 | + $this->comment(PHP_EOL . Inspiring::quote() . PHP_EOL); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |