Compare commits
3 Commits
main
...
fix-layout
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
732318d282 | ||
|
|
c76c1fa8f7 | ||
|
|
e406257121 |
0
Dockerfile
Executable file → Normal file
0
Dockerfile.dev
Executable file → Normal file
0
Gruntfile.js
vendored
Executable file → Normal file
0
app/Console/Kernel.php
Executable file → Normal file
0
app/Exceptions/Handler.php
Executable file → Normal file
0
app/Helpers/FormatterHelper.php
Executable file → Normal file
0
app/Http/Controllers/Auth/ForgotPasswordController.php
Executable file → Normal file
0
app/Http/Controllers/Auth/LoginController.php
Executable file → Normal file
0
app/Http/Controllers/Auth/RegisterController.php
Executable file → Normal file
0
app/Http/Controllers/Auth/ResetPasswordController.php
Executable file → Normal file
12
app/Http/Controllers/CalendarController.php
Executable file → Normal file
@@ -6,20 +6,26 @@ use \Illuminate\Http\Request;
|
||||
|
||||
class CalendarController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
parent::registerView($request, 'agenda', $id);
|
||||
$apiResult = $this->API('agenda/item/' . (int)$id);
|
||||
$calendarEvent = new \Model\CalendarEvent($apiResult->news);
|
||||
$calendarEvent = new \Model\CalendarEvent($apiResult);
|
||||
|
||||
return view('calendarevent', array_merge($this->getSidebareData(), ['event' => $calendarEvent, 'metadata' => $calendarEvent->metadata]));
|
||||
}
|
||||
|
||||
public function overview(Request $request)
|
||||
{
|
||||
$apiResult = $this->API('agenda/overzicht?aantal=100');
|
||||
$apiResult = $this->API('agenda/overzicht');
|
||||
$calendar = [];
|
||||
foreach($apiResult->events as $calendarItem)
|
||||
foreach($apiResult as $calendarItem)
|
||||
{
|
||||
$calendar[] = new \Model\CalendarEvent($calendarItem);
|
||||
}
|
||||
|
||||
94
app/Http/Controllers/Controller.php
Executable file → Normal file
@@ -19,9 +19,9 @@ class Controller extends BaseController
|
||||
|
||||
private function getDataFromFileAndConvert($file, $path, $class, $maxItems = 0)
|
||||
{
|
||||
$data = json_decode(Storage::get($file));
|
||||
$data = json_decode(Storage::disk('local')->get($file));
|
||||
foreach ($path as $subobject) {
|
||||
$data = $data->$subobject ?? [];
|
||||
$data = $data->$subobject;
|
||||
}
|
||||
$items = [];
|
||||
foreach ($data as $item_data) {
|
||||
@@ -39,30 +39,39 @@ class Controller extends BaseController
|
||||
View::share('apiUrl', $this->API_URL = env('API_URL', 'http://api.6fm.nl/'));
|
||||
View::share('imgBase', env('IMAGE_BASE_URL', '/'));
|
||||
|
||||
$blogs = $this->getDataFromFileAndConvert('blogs.json', [], '\Model\Blog', 1);
|
||||
$activeBlog = count($blogs) && $blogs[0]->is_active ? $blogs[0] : null;
|
||||
View::share('activeBlog', $activeBlog);
|
||||
|
||||
|
||||
//View::share('onAir', file_get_contents(url('onair')));
|
||||
View::composer('widgets.laatstenieuws', function ($view) {
|
||||
$view->with('data', $this->getDataFromFileAndConvert('laatste_nieuws.json', ['news'], '\Model\NewsItem'));
|
||||
});
|
||||
View::composer('widgets.populairnieuws', function ($view) {
|
||||
$view->with('data', $this->getDataFromFileAndConvert('populair_nieuws.json', ['news'], '\Model\NewsItem'));
|
||||
$view->with('data', $this->getDataFromFileAndConvert('populair_nieuws.json', [], '\Model\NewsItem'));
|
||||
});
|
||||
View::composer('widgets.nustraks', function ($view) {
|
||||
$data = json_decode(Storage::get('nu_straks.json'))->schedule;
|
||||
$data = json_decode(Storage::disk('local')->get('nu_straks.json'))->schedule;
|
||||
$programs = [];
|
||||
foreach ($data as $item_data) {
|
||||
$programs[] = $program = new \Model\Program($item_data->program);
|
||||
$program->start = self::JsonToDateTime($item_data->start);
|
||||
$program->end = self::JsonToDateTime($item_data->end);
|
||||
$program->start = new \DateTimeImmutable($item_data->start->date,
|
||||
new \DateTimeZone($item_data->start->timezone));
|
||||
$program->end = new \DateTimeImmutable($item_data->end->date,
|
||||
new \DateTimeZone($item_data->end->timezone));
|
||||
}
|
||||
|
||||
// Need a bit of slack here, otherwise the current program may show up
|
||||
$now = new \DateTimeImmutable('2 minutes ago');
|
||||
$data = json_decode(Storage::get('zojuist.json'))->schedule;
|
||||
$data = json_decode(Storage::disk('local')->get('zojuist.json'))->schedule;
|
||||
$i = 0;
|
||||
foreach (array_reverse($data) as $item_data) {
|
||||
$recent = $program = new \Model\Program($item_data->program);
|
||||
$recent->start = self::JsonToDateTime($item_data->start);
|
||||
$recent->end = self::JsonToDateTime($item_data->end);
|
||||
$recent->start = new \DateTimeImmutable($item_data->start->date,
|
||||
new \DateTimeZone($item_data->start->timezone));
|
||||
$recent->end = new \DateTimeImmutable($item_data->end->date,
|
||||
new \DateTimeZone($item_data->end->timezone));
|
||||
if (($recent->end < $now) && (!$recent->nonstop) && (!$recent->rerun)) {
|
||||
$view->with('recent', $recent);
|
||||
break;
|
||||
@@ -72,10 +81,8 @@ class Controller extends BaseController
|
||||
$view->with('data', $programs);
|
||||
});
|
||||
View::composer('widgets.laatstepodcasts', function ($view) {
|
||||
$view->with(
|
||||
'data',
|
||||
$this->getDataFromFileAndConvert('laatste_podcasts.json', ['podcasts'], '\Model\Podcast')
|
||||
);
|
||||
$view->with('data',
|
||||
$this->getDataFromFileAndConvert('laatste_podcasts.json', ['podcasts'], '\Model\Podcast'));
|
||||
});
|
||||
View::composer('widgets.regioagenda', function ($view) {
|
||||
$view->with('data', $this->getDataFromFileAndConvert('regioagenda.json', [], '\Model\CalendarEvent'));
|
||||
@@ -85,17 +92,12 @@ class Controller extends BaseController
|
||||
});
|
||||
View::composer('widgets.menu', function ($view) {
|
||||
$view->with('news', $this->getDataFromFileAndConvert('laatste_nieuws.json', ['news'], '\Model\NewsItem'))
|
||||
->with('popular', $this->getDataFromFileAndConvert('populair_nieuws.json', ['news'], '\Model\NewsItem', 3))
|
||||
->with(
|
||||
'podcasts',
|
||||
$this->getDataFromFileAndConvert('laatste_podcasts.json', ['podcasts'], '\Model\Podcast')
|
||||
);
|
||||
});
|
||||
View::composer('widgets.menu', function($view) {
|
||||
$view->with('items', json_decode(Storage::get('static/menu.json')));
|
||||
->with('popular', $this->getDataFromFileAndConvert('populair_nieuws.json', [], '\Model\NewsItem', 3))
|
||||
->with('podcasts',
|
||||
$this->getDataFromFileAndConvert('laatste_podcasts.json', ['podcasts'], '\Model\Podcast'));
|
||||
});
|
||||
|
||||
View::share('disableBanners', env('DISABLE_BANNERS', false));
|
||||
View::share('disableBanners', env('DISABLE_BANNERS', true));
|
||||
}
|
||||
|
||||
protected function registerView(Request $request, $type, $id)
|
||||
@@ -104,34 +106,31 @@ class Controller extends BaseController
|
||||
return;
|
||||
}
|
||||
|
||||
app('db')->insert(
|
||||
'INSERT INTO `pagestats`(`type`, `item_id`, `visitor_ip`, `session`, `referer`) VALUES(:type, :id, :ip, :session, :referer)',
|
||||
app('db')->insert('INSERT INTO `pagestats`(`type`, `item_id`, `visitor_ip`, `session`, `referer`) VALUES(:type, :id, :ip, :session, :referer)',
|
||||
[
|
||||
'type' => $type,
|
||||
'id' => $id,
|
||||
'ip' => $request->server('REMOTE_ADDR'),
|
||||
'session' => md5(Session::getId()),
|
||||
'referer' => $request->server('HTTP_REFERRER')
|
||||
]
|
||||
);
|
||||
]);
|
||||
}
|
||||
|
||||
protected function API($url)
|
||||
{
|
||||
// if (strpos($url, 'nieuws/overzicht') !== false) {
|
||||
// return json_decode(file_get_contents(__DIR__ . '/../../../storage/app/laatste_nieuws.json'));
|
||||
// }
|
||||
// return [];
|
||||
|
||||
$arrContextOptions = [
|
||||
'ssl' => [
|
||||
"verify_peer" => false,
|
||||
"verify_peer_name" => false,
|
||||
],
|
||||
'http' => [
|
||||
'method' => 'GET',
|
||||
'header' => 'X-Api-Key: ' . sha1(request()->server('REMOTE_ADDR')) . "\r\n"
|
||||
. 'X-User-Agent: ' . request()->server('HTTP_USER_AGENT') . "\r\n"
|
||||
]
|
||||
];
|
||||
//\dump($http_response_header);
|
||||
$result = @file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions));
|
||||
return $result ? json_decode($result) : null;
|
||||
|
||||
return json_decode(file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions)));
|
||||
}
|
||||
|
||||
protected function checkAPI($url)
|
||||
@@ -149,10 +148,9 @@ class Controller extends BaseController
|
||||
|
||||
protected static function JsonToDateTime($obj)
|
||||
{
|
||||
return is_object($obj) ? new \DateTime($obj->date, new \DateTimeZone($obj->timezone)) : \Carbon\Carbon::parse($obj)->setTimezone(date_default_timezone_get());
|
||||
return new \DateTime($obj->date, new \DateTimeZone($obj->timezone));
|
||||
}
|
||||
|
||||
/*
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if (substr($method, 0, 5) == 'view_') {
|
||||
@@ -162,15 +160,14 @@ class Controller extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
return abort(404);
|
||||
return abort(404);
|
||||
}
|
||||
*/
|
||||
|
||||
public function getSidebareData()
|
||||
{
|
||||
$populair = [];
|
||||
$apiResult = $this->API('nieuws/populair?aantal=5');
|
||||
foreach ($apiResult->news as $_newsItem) {
|
||||
foreach ($apiResult as $_newsItem) {
|
||||
$populair[] = new \Model\NewsItem($_newsItem);
|
||||
}
|
||||
|
||||
@@ -182,23 +179,4 @@ class Controller extends BaseController
|
||||
|
||||
return ['newsItems' => $newsItems, 'populair' => $populair];
|
||||
}
|
||||
|
||||
public function static_page($slug)
|
||||
{
|
||||
if (view()->exists($slug)) {
|
||||
return view($slug);
|
||||
}
|
||||
|
||||
$page = $this->API('statisch/' . $slug);
|
||||
if ($page == null) {
|
||||
return abort(404);
|
||||
}
|
||||
|
||||
$page->published = Controller::JsonToDateTime($page->published);
|
||||
if ($page->edited) {
|
||||
$page->edited = Controller::JsonToDateTime($page->edited);
|
||||
}
|
||||
|
||||
return view('static', compact('page'));
|
||||
}
|
||||
}
|
||||
|
||||
16
app/Http/Controllers/HomeController.php
Executable file → Normal file
@@ -14,17 +14,21 @@ class HomeController extends Controller
|
||||
$news = [];
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
}
|
||||
}
|
||||
|
||||
$populair = [];
|
||||
$apiResult = $this->API('nieuws/populair?pagina=' . (int)max(1, $page) . '&aantal=5');
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
foreach ($apiResult as $newsItem) {
|
||||
$populair[] = new \Model\NewsItem($newsItem);
|
||||
}
|
||||
|
||||
$apiResult = $this->API('podcast/overzicht?aantal=15');
|
||||
$index = array_rand($apiResult->podcasts);
|
||||
$podcast = new \Model\Podcast($apiResult->podcasts[$index]);
|
||||
return view('home', ['populair' => $populair, 'podcast' => $podcast, 'title' => 'Home', 'news' => $news, 'searchURL' => 'nieuws/zoeken']);
|
||||
$podcasts = [];
|
||||
$apiResult = $this->API('podcast/overzicht?aantal=3');
|
||||
$podcast = new \Model\Podcast($apiResult->podcasts[0]);
|
||||
foreach ($apiResult->podcasts as $_podcast) {
|
||||
$podcasts[] = new \Model\Podcast($_podcast);
|
||||
}
|
||||
|
||||
return view('home', ['populair' => $populair, 'podcasts' => $podcasts, 'podcast' => $podcast, 'title' => 'Home', 'news' => $news, 'searchURL' => 'nieuws/zoeken']);
|
||||
}
|
||||
}
|
||||
|
||||
0
app/Http/Controllers/ImagesController.php
Executable file → Normal file
10
app/Http/Controllers/JobsController.php
Executable file → Normal file
@@ -29,12 +29,12 @@ class JobsController extends Controller
|
||||
private function listJobs(Request $request, $url, $title = null)
|
||||
{
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
#$apiResult = $this->API('vacatures/' . $url . '?pagina=' . (int)max(1, $page));
|
||||
$apiResult = $this->API('vacatures/' . $url . '?pagina=' . (int)max(1, $page));
|
||||
$jobs = [];
|
||||
#foreach($apiResult->jobs as $jobsItem)
|
||||
#{
|
||||
# $jobs[] = new \Model\JobOpening($jobsItem);
|
||||
#}
|
||||
foreach($apiResult->jobs as $jobsItem)
|
||||
{
|
||||
$jobs[] = new \Model\JobOpening($jobsItem);
|
||||
}
|
||||
|
||||
return view('jobslist', array_merge($this->getSidebareData(), ['title' => $title, 'jobs' => $jobs]));
|
||||
//return view($request->ajax() ? 'partial/jobslist_small' : ($title == null ? 'home' : 'jobslist'), ['title' => $title, 'jobs' => $jobs, 'searchURL' => 'vacatures/zoeken']);
|
||||
|
||||
0
app/Http/Controllers/KerkdienstController.php
Executable file → Normal file
53
app/Http/Controllers/NewsController.php
Executable file → Normal file
@@ -17,30 +17,27 @@ class NewsController extends Controller
|
||||
public function show(Request $request, $id)
|
||||
{
|
||||
parent::registerView($request, 'nieuws', $id);
|
||||
$preview = "";
|
||||
if(request()->get('preview', null) != null) {
|
||||
$preview = "?preview=" . request()->get('preview');
|
||||
}
|
||||
$apiResult = $this->API('nieuws/bericht/' . $id . $preview);
|
||||
$apiResult = $this->API('nieuws/bericht/' . $id);
|
||||
$newsItem = new \Model\NewsItem($apiResult->news);
|
||||
|
||||
switch ($apiResult->version) {
|
||||
case 1:
|
||||
if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
|
||||
if (!$newsItem->content) return redirect('//nhnieuws.nl/gooi');
|
||||
return view('newsitem', ['news' => $newsItem, 'metadata' => $newsItem->metadata]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if(isset($apiResult->source->article)) {
|
||||
$source = $apiResult->source->article;
|
||||
case 2:
|
||||
$source = $apiResult->source;
|
||||
$newsItem->published = self::TimestampToDateTime($source->created);
|
||||
$newsItem->edited = self::TimestampToDateTime($source->updated);
|
||||
$newsItem->author = $source->author;
|
||||
$newsItem->images = null; // Images will be embedded
|
||||
$newsItem->video = null; // Videos will be embedded
|
||||
$newsItem->content = $source->blocks;
|
||||
} elseif(isset($apiResult->source->blocks)) {
|
||||
$newsItem->content = $apiResult->source->blocks;
|
||||
}
|
||||
return view('newsitem', array_merge($this->getSidebareData(), ['type' => $apiResult->type, 'news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
|
||||
$newsItem->content = $source->blocks;
|
||||
|
||||
|
||||
|
||||
return view('newsitem', array_merge($this->getSidebareData(), ['news' => $newsItem, 'metadata' => $newsItem->metadata, 'searchURL' => 'nieuws/zoeken']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,26 +65,21 @@ class NewsController extends Controller
|
||||
$id = $request->get('id', '');
|
||||
$populair = [];
|
||||
$apiResult = $this->API('nieuws/populair?pagina=' . (int)max(1, $page) . '&aantal=5');
|
||||
foreach ($apiResult->news as $_newsItem) {
|
||||
foreach ($apiResult as $_newsItem) {
|
||||
$populair[] = new \Model\NewsItem($_newsItem);
|
||||
}
|
||||
|
||||
return view('partial/newslist_small', ['id' => $id, 'news' => $populair]);
|
||||
}
|
||||
|
||||
public function taglist(Request $request, $tag)
|
||||
{
|
||||
return $this->listNews($request, 'tag/' . $tag, ucfirst($tag));
|
||||
}
|
||||
|
||||
public function regionlist(Request $request, $region)
|
||||
{
|
||||
return $this->listNews($request, 'tag/' . $region, ucfirst($region));
|
||||
return $this->listNews($request, 'regio/' . $region, ucfirst($region));
|
||||
}
|
||||
|
||||
public function themelist(Request $request, $theme)
|
||||
{
|
||||
return $this->listNews($request, 'tag/' . $theme, ucfirst($theme));
|
||||
return $this->listNews($request, 'thema/' . $theme, ucfirst($theme));
|
||||
}
|
||||
|
||||
public function search(Request $request, $query)
|
||||
@@ -141,12 +133,9 @@ class NewsController extends Controller
|
||||
$total = 5;
|
||||
}
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
if ($url == 'overzicht' && $request->get('dateStart', null) && $request->get('dateEnd', null)) {
|
||||
$url = 'datum/' . $request->get('dateStart', null) . '/' . $request->get('dateEnd', null);
|
||||
}
|
||||
$apiResult = $this->API('nieuws/' . $url . '?pagina=' . (int)max(1, $page) . ($total ? '&aantal=' . $total : ''));
|
||||
$news = [];
|
||||
foreach ($apiResult->news ?? [] as $newsItem) {
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
}
|
||||
|
||||
@@ -156,7 +145,7 @@ class NewsController extends Controller
|
||||
}
|
||||
$apiResult = $this->API('nieuws/populair?pagina=' . (int)max(1,
|
||||
$page) . ($total ? '&aantal=' . $total : ''));
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
foreach ($apiResult as $newsItem) {
|
||||
$populair[] = new \Model\NewsItem($newsItem);
|
||||
}
|
||||
|
||||
@@ -183,7 +172,7 @@ class NewsController extends Controller
|
||||
{
|
||||
$apiResult = $this->API('nieuws/populair');
|
||||
$news = [];
|
||||
foreach ($apiResult->news as $newsItem) {
|
||||
foreach ($apiResult as $newsItem) {
|
||||
$news[] = new \Model\NewsItem($newsItem);
|
||||
}
|
||||
|
||||
@@ -192,15 +181,11 @@ class NewsController extends Controller
|
||||
|
||||
public function regionieuws()
|
||||
{
|
||||
$data = $this->API('nieuws/regionieuws.json');
|
||||
return view('listen', [
|
||||
'source' => $this->API_URL . 'nieuws/regionieuws.mp3',
|
||||
'source' => $this->API_URL . 'nieuws/regionieuws',
|
||||
'title' => 'Regionieuws',
|
||||
'content' => 'het laatste nieuws uit de regio',
|
||||
'isStream' => false,
|
||||
'canDownload' => true,
|
||||
'lengte' => $data->length * 0.25,
|
||||
'waveform' => $data
|
||||
]);
|
||||
'canDownload' => true]);
|
||||
}
|
||||
}
|
||||
|
||||
15
app/Http/Controllers/PodcastController.php
Executable file → Normal file
@@ -29,23 +29,14 @@ class PodcastController extends Controller
|
||||
$podcasts[] = new \Model\Podcast($podcast);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial.podcastitems' : 'podcastseries', array_merge($viewData, ['podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken', 'isPodcast' => true]));
|
||||
return view($request->ajax() ? 'partial.podcastitems' : 'podcastseries', array_merge($viewData, ['podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
public function podcast(Request $request, $id)
|
||||
{
|
||||
parent::registerView($request, 'podcast', $id);
|
||||
$apiResult = $this->API('podcast/details/' . (int)$id);
|
||||
$podcast = new \Model\Podcast($apiResult);
|
||||
$podcasts = [];
|
||||
if($podcast->program) {
|
||||
$apiResult = $this->API('podcast/programma/' . (int)$podcast->program->id . '?pagina=1&aantal=5');
|
||||
$podcasts = [];
|
||||
foreach($apiResult->podcasts as $p)
|
||||
{
|
||||
$podcasts[] = new \Model\Podcast($p);
|
||||
}
|
||||
}
|
||||
return view('podcastitem', ['podcast' => $podcast, 'metadata' => $podcast->metadata, 'podcasts' => $podcasts, 'isPodcast' => true]);
|
||||
$podcast = new \Model\Podcast($apiResult);
|
||||
return view('podcastitem', ['podcast' => $podcast, 'metadata' => $podcast->metadata]);
|
||||
}
|
||||
}
|
||||
|
||||
15
app/Http/Controllers/RadioController.php
Executable file → Normal file
@@ -49,17 +49,14 @@ class RadioController extends Controller
|
||||
|
||||
public function program($id)
|
||||
{
|
||||
$apiResult = $this->API('programma/details/' . (int)$id);
|
||||
if($apiResult == null) {
|
||||
return abort(404);
|
||||
}
|
||||
$apiResult = $this->API('programma/details/' . (int)$id);
|
||||
return view('radioprogram', ['program' => new \Model\Program($apiResult)]);
|
||||
}
|
||||
|
||||
public function podcast(Request $request, $id, $title = '')
|
||||
{
|
||||
if($this->checkAPI('podcast/details/' . (int)$id) != "200"){
|
||||
return view('podcastitem', array_merge($this->getSidebareData(), ['title' => $title, 'podcast' => null, 'metadata' => null, 'related' => [], 'searchURL' => 'gemist/zoeken', 'isPodcast' => false]));
|
||||
return view('podcastitem', array_merge($this->getSidebareData(), ['title' => $title, 'podcast' => null, 'metadata' => null, 'related' => [], 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
parent::registerView($request, 'podcast', $id);
|
||||
@@ -74,7 +71,7 @@ class RadioController extends Controller
|
||||
$podcasts[] = new \Model\Podcast($_podcast);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial/podcastitems' : 'podcastitem', ['title' => $title, 'podcast' => $podcast, 'metadata' => $podcast->metadata, 'podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken', 'isPodcast' => false]);
|
||||
return view($request->ajax() ? 'partial/podcastitems' : 'podcastitem', ['title' => $title, 'podcast' => $podcast, 'metadata' => $podcast->metadata, 'podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken']);
|
||||
}
|
||||
|
||||
public function podcasts(Request $request, $programma = null)
|
||||
@@ -98,7 +95,7 @@ class RadioController extends Controller
|
||||
{
|
||||
$programs = [];
|
||||
$now = new \DateTimeImmutable('2 minutes ago');
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
$page = (int)$request->get('pagina', 1);
|
||||
$apiResult = $this->API('programma/schema/recent?pagina=' . (int)max(1, $page) . '&aantal=12');
|
||||
foreach($apiResult->schedule as $item) {
|
||||
if(!$item->program->nonstop && !$item->program->rerun) {
|
||||
@@ -110,7 +107,7 @@ class RadioController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial/programitems' : 'programlist', ['programs' => array_reverse($programs), 'isPodcast' => false]);
|
||||
return view($request->ajax() ? 'partial/programitems' : 'programlist', ['programs' => array_reverse($programs)]);
|
||||
}
|
||||
|
||||
private function getPodcastList(Request $request, $action, $viewData = [])
|
||||
@@ -123,7 +120,7 @@ class RadioController extends Controller
|
||||
$podcasts[] = new \Model\Podcast($podcast);
|
||||
}
|
||||
|
||||
return view($request->ajax() ? 'partial/podcastitems' : 'podcastlist', array_merge($viewData, ['id' => 'items-podcasts', 'podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken', 'isPodcast' => false]));
|
||||
return view($request->ajax() ? 'partial/podcastitems' : 'podcastlist', array_merge($viewData, ['id' => 'items-podcasts', 'podcasts' => $podcasts, 'searchURL' => 'gemist/zoeken']));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
0
app/Http/Controllers/SpecialController.php
Executable file → Normal file
36
app/Http/Controllers/StreamController.php
Executable file → Normal file
@@ -14,8 +14,6 @@ class StreamController extends Controller
|
||||
return view('listen', [
|
||||
'source' => self::$STREAM_URL . 'mp3live',
|
||||
'title' => 'Luister live',
|
||||
'lengte' => 0,
|
||||
'waveform' => null,
|
||||
'content' => 'de live-uitzending van NH Gooi.',
|
||||
'isStream' => true ]);
|
||||
}
|
||||
@@ -32,17 +30,6 @@ class StreamController extends Controller
|
||||
return view('watch', ['title' => 'Kijk NH Gooi Tv Studio', 'stream' => 'https://studiocam.nhgooi.nl/studiocam/live/index.m3u8']);
|
||||
}
|
||||
|
||||
public function inline(Request $request, $id)
|
||||
{
|
||||
$apiResult = $this->API('podcast/details/' . (int)$id);
|
||||
$podcast = new \Model\Podcast($apiResult);
|
||||
if(sha1($id . ':' . date('Y-m-d')) != $request->get('auth')) {
|
||||
// return view('widgets/podcastplayer', ['podcast' => null]);
|
||||
}
|
||||
|
||||
return view('widgets/podcastplayer', ['podcast' => $podcast]);
|
||||
}
|
||||
|
||||
public function podcast(Request $request, $id)
|
||||
{
|
||||
$apiResult = $this->API('podcast/details/' . (int)$id);
|
||||
@@ -52,23 +39,16 @@ class StreamController extends Controller
|
||||
}
|
||||
|
||||
return view('listen', [
|
||||
'source' => $this->API_URL . 'podcast/stream/' . $apiResult->url,
|
||||
'source' => $this->API_URL . 'podcast/download' . $apiResult->url . '?auth=' . $podcast->auth,
|
||||
'title' => $podcast->title,
|
||||
'content' => $podcast->title,
|
||||
'lengte' => $podcast->duration / 1000,
|
||||
'waveform' => $podcast->waveform,
|
||||
'isStream' => false,
|
||||
'canDownload' => $this->API_URL . 'podcast/download/' . $apiResult->url ]);
|
||||
'canDownload' => true ]);
|
||||
}
|
||||
|
||||
public function program(Request $request, $year, $month, $day, $hour, $duration, $offset = 0) {
|
||||
$date = (new \DateTimeImmutable())->setDate($year, $month, $day)->setTime($hour, 0, 0);
|
||||
$current = $date->add(\DateInterval::createFromDateString($offset . ' hours'));
|
||||
|
||||
$programma = $this->API("programma/details/" . $current->Format("Y/m/d/H"));
|
||||
if(!$programma->is_beschikbaar) {
|
||||
return view('listen', ['notAvailable' => true]);
|
||||
}
|
||||
$current = $date->add(\DateInterval::createFromDateString($offset . ' hours'));
|
||||
|
||||
$hours = [];
|
||||
for($i = 0; $i < $duration; $i++) {
|
||||
@@ -78,12 +58,10 @@ class StreamController extends Controller
|
||||
}
|
||||
|
||||
return view('listen', [
|
||||
'source' => $this->API_URL . 'programma/stream/' . $current->format('Y/m/d/H'),
|
||||
'source' => $this->API_URL . 'programma/download/' . $current->format('Y/m/d/H') . '/1',
|
||||
'tabs' => $hours,
|
||||
'title' => 'Uitzending terugluisteren',
|
||||
'lengte' => $programma->waveform->length,
|
||||
'waveform' => $programma->waveform,
|
||||
'content' => $programma->programma->name . ' van ' . $current->format('d-m-Y, H') . ':00 uur',
|
||||
'content' => 'de uitzending van ' . $current->format('d-m-Y, H') . ':00 uur',
|
||||
'isStream' => false,
|
||||
'canDownload' => false ]);
|
||||
}
|
||||
@@ -99,10 +77,10 @@ class StreamController extends Controller
|
||||
|
||||
public function kerkdienst(Request $request) {
|
||||
return view('listen', [
|
||||
'source' => $this->API_URL . 'kerkdienst/stream',
|
||||
'source' => $this->API_URL . 'kerkdienst/download',
|
||||
'title' => 'Kerkdienst gemist',
|
||||
'content' => 'de kerkdienst van afgelopen zondag',
|
||||
'isStream' => false,
|
||||
'canDownload' => $this->API_URL . 'kerkdienst/download' ]);
|
||||
'canDownload' => true ]);
|
||||
}
|
||||
}
|
||||
|
||||
0
app/Http/Kernel.php
Executable file → Normal file
0
app/Http/Middleware/EncryptCookies.php
Executable file → Normal file
0
app/Http/Middleware/RedirectIfAuthenticated.php
Executable file → Normal file
0
app/Http/Middleware/TrimStrings.php
Executable file → Normal file
0
app/Http/Middleware/VerifyCsrfToken.php
Executable file → Normal file
@@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Blog extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $description;
|
||||
public $news_category;
|
||||
public $start_date;
|
||||
public $end_date;
|
||||
public $is_active;
|
||||
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->start_date);
|
||||
parent::ConvertToDateTime($this->end_date);
|
||||
|
||||
$this->url = "/blog/{$this->id}/" . parent::url_slug($this->title);
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class CalendarEvent extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $region;
|
||||
public $content;
|
||||
public $starts;
|
||||
public $ends;
|
||||
public $images;
|
||||
public $podcast;
|
||||
public $video;
|
||||
public $keywords;
|
||||
public $url;
|
||||
public $metadata;
|
||||
public $tags;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->starts);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
if($podcast)
|
||||
{
|
||||
$this->podcast = new \Model\Podcast($podcast);
|
||||
} else if(isset($data->podcast) && $data->podcast) {
|
||||
$this->podcast = new \Model\Podcast($data->podcast);
|
||||
}
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
$this->images = [];
|
||||
foreach($images as $image) {
|
||||
$this->images[] = new NewsImage($image, '/img/news/');
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = "/agenda/{$this->id}/" . parent::url_slug($this->title);
|
||||
$this->metadata = (new MetaData())
|
||||
->set('title', $this->title)
|
||||
->set('description', strip_tags($this->excerpt()))
|
||||
->set('image', isset($this->images) && count($this->images) ? $this->images[0]->url : null )
|
||||
->set('audio', isset($this->podcast) ? $this->podcast->url : null)
|
||||
;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = isset($this->images) && count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class JobOpening extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $content;
|
||||
public $starts;
|
||||
public $ends;
|
||||
public $images;
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->starts);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
if($podcast)
|
||||
{
|
||||
$this->podcast = new \Model\Podcast($podcast);
|
||||
} else if(isset($data->podcast) && $data->podcast) {
|
||||
$this->podcast = new \Model\Podcast($data->podcast);
|
||||
}
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
$this->images = [];
|
||||
foreach($images as $image) {
|
||||
$this->images[] = new NewsImage($image, '/img/news/');
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = "/vacatures/{$this->id}/" . parent::url_slug($this->title);
|
||||
$this->metadata = (new MetaData())
|
||||
->set('title', $this->title)
|
||||
->set('description', strip_tags($this->excerpt()))
|
||||
->set('image', isset($this->images) && count($this->images) ? $this->images[0]->url : null )
|
||||
->set('audio', isset($this->podcast) ? $this->podcast->url : null)
|
||||
;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class KerkdienstInstance extends Model {
|
||||
public $name;
|
||||
public $start;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->start);
|
||||
}
|
||||
}
|
||||
|
||||
class Kerkdienst extends Model {
|
||||
public $isRunning;
|
||||
public $previous;
|
||||
public $next;
|
||||
|
||||
public function __construct($data) {
|
||||
// parent::__construct($data);
|
||||
$this->isRunning = $data->isRunning;
|
||||
$this->previous = new KerkdienstInstance($data->previous);
|
||||
$this->next = new KerkdienstInstance($data->next);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
namespace Model;
|
||||
|
||||
class MetaData {
|
||||
private $data = ['type' => 'article', 'locale' => 'nl-nl'];
|
||||
|
||||
public function set($prop, $val) {
|
||||
if($val) {
|
||||
$this->data[$prop] = $val;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function append($prop, $val) {
|
||||
if(array_key_exists($prop, $this->data)) {
|
||||
$this->data[$prop] .= $val;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function prepend($prop, $val) {
|
||||
if(array_key_exists($prop, $this->data)) {
|
||||
$this->data[$prop] = $val . $this->data[$prop];
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function metaTags() {
|
||||
foreach($this->data as $prop => $val) {
|
||||
if($val) {
|
||||
echo "<meta property=\"og:$prop\" content=\"" . htmlentities($val) . "\" />\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Model {
|
||||
protected function ConvertToDateTime(&$field) {
|
||||
if($field) {
|
||||
// PHP7 JSON-encodes to {date: "", "timezone_type": ..., "timezone": "UTC" }
|
||||
// In that case $field will be an object
|
||||
if(is_object($field)) {
|
||||
$field = ($field->timezone)
|
||||
? new \DateTimeImmutable($field->date, new \DateTimeZone($field->timezone))
|
||||
: (new \DateTimeImmutable($field->date));
|
||||
} else {
|
||||
// If $field is not an object, assume it's a plain, valid, string
|
||||
$field = new \DateTime($field);
|
||||
}
|
||||
|
||||
if($field === false || $field->getTimestamp() <= 0) {
|
||||
// If field had data but is invalid DateTime or is 0000-00-00 00:00, set it to null.
|
||||
$field = null;
|
||||
} else {
|
||||
// If valid, return local timezone
|
||||
$field->setTimezone(new \DateTimeZone("Europe/Amsterdam"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct($data) {
|
||||
$class = get_class($this);
|
||||
foreach($data as $key => $val) {
|
||||
if(property_exists($class, $key)) {
|
||||
$this->$key = is_string($val) ? stripslashes($val) : $val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function url_slug($text) {
|
||||
// Alles naar kleine letter
|
||||
$text = strtolower($text);
|
||||
|
||||
// Vervang accent-tekens door niet-geaccentueerde versies
|
||||
// $text = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $text);
|
||||
$search = explode(",","ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u");
|
||||
$replace = explode(",","c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u");
|
||||
$text = str_replace($search, $replace, $text);
|
||||
|
||||
// Verwijder alle woorden van 3 letters, behalve BEL (BEL-combinatie etc)
|
||||
if(strlen($text) > 3) {
|
||||
$text = preg_replace('/\b(?!bel|fm|nh)([a-z]{1,3})\b/u', '', $text);
|
||||
}
|
||||
|
||||
// Vervang alles dat niet een woord-karakter is (letter, cijfer), een streepje of spatie
|
||||
if(strlen($text) > 3) {
|
||||
$text = preg_replace('/[^\w_\-\s]/', '', $text);
|
||||
}
|
||||
|
||||
// Reeksen van één of meer spaties / streepjes vervangen door een enkel streepje
|
||||
$text = preg_replace('/[\-\s]+/', '-', $text);
|
||||
|
||||
// Verwijder alle witruimte / streepjes aan begin en eind
|
||||
return trim(strtolower($text), '-');
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class NewsImage extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $author;
|
||||
public $url;
|
||||
|
||||
public function __construct($data, $urlPrefix = '/') {
|
||||
parent::__construct($data);
|
||||
|
||||
// Deserialisatie van JSON heeft url in data,
|
||||
// lezen uit database heeft file en (als het goed is) urlPrefix
|
||||
if(isset($data->file)) {
|
||||
$this->url = $urlPrefix . $data->file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
require_once "NewsImage.php";
|
||||
require_once "NewsSource.php";
|
||||
require_once "MetaData.php";
|
||||
|
||||
class NewsItem extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $author;
|
||||
public $content;
|
||||
public $published;
|
||||
public $edited;
|
||||
public $keywords;
|
||||
|
||||
public $source;
|
||||
public $category;
|
||||
public $theme;
|
||||
public $region;
|
||||
public $tags;
|
||||
|
||||
public $podcast;
|
||||
public $images;
|
||||
public $video;
|
||||
|
||||
public $url;
|
||||
public $metadata;
|
||||
|
||||
public function __construct($data, $images = null, $podcast = null) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->published);
|
||||
parent::ConvertToDateTime($this->edited);
|
||||
|
||||
if($this->edited && ($this->edited->getTimestamp() - $this->published->getTimestamp() < 1800 /* == 30 minutes */)) {
|
||||
// If last edit was within grace period, consider it unedited (note: currently RES always saves edited == published on creation)
|
||||
$this->edited = null;
|
||||
}
|
||||
|
||||
$this->source = null;
|
||||
if(isset($data->source))
|
||||
{
|
||||
if(is_object($data->source))
|
||||
{
|
||||
$this->source = new \Model\NewsSource($data->source->title, $data->source->url, $data->source->show);
|
||||
} else if($data->source) {
|
||||
$this->source = new \Model\NewsSource($data->source, $data->source_url, $data->showsource);
|
||||
}
|
||||
}
|
||||
|
||||
if($podcast) {
|
||||
$this->podcast = new \Model\Podcast($podcast);
|
||||
} else if(isset($data->podcast) && $data->podcast) {
|
||||
$this->podcast = new \Model\Podcast($data->podcast);
|
||||
}
|
||||
|
||||
$this->keywords = null;
|
||||
if(isset($data->keywords)) {
|
||||
if(is_array($data->keywords) || is_object($data->keywords)) {
|
||||
$this->keywords = $data->keywords;
|
||||
} else if(trim($data->keywords)) {
|
||||
$this->keywords = explode(' ', $data->keywords);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->region)) {
|
||||
if(is_object($data->region)) {
|
||||
$this->region = new \Model\NewsRegion($data->region->title, $data->region->slug);
|
||||
} else {
|
||||
$this->region = new \Model\NewsRegion($data->region, $data->region_slug);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->theme)) {
|
||||
if(is_object($data->theme)) {
|
||||
$this->theme = new \Model\NewsRegion($data->theme->title, $data->theme->slug);
|
||||
} else {
|
||||
$this->theme = new \Model\NewsRegion($data->theme, $data->theme_slug);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->tags)) {
|
||||
foreach($data->tags as $tag) {
|
||||
$this->theme = new \Model\NewsRegion($tag->titel, $tag->slug);
|
||||
}
|
||||
}
|
||||
|
||||
$images = ($images != null) ? $images
|
||||
: (isset($data->images) ? $data->images : null);
|
||||
if($images) {
|
||||
$this->images = [];
|
||||
foreach($images as $image) {
|
||||
$this->images[] = new NewsImage($image, '/img/news/');
|
||||
}
|
||||
}
|
||||
|
||||
$this->url = "/nieuws/{$this->id}/" . parent::url_slug($this->title);
|
||||
$this->metadata = (new MetaData())
|
||||
->set('title', $this->title)
|
||||
->set('description', strip_tags($this->excerpt()))
|
||||
->set('image', isset($this->images) && count($this->images) ? $this->images[0]->url : null )
|
||||
->set('video', isset($this->video) ? $this->video : null)
|
||||
->set('audio', isset($this->podcast) ? $this->podcast->url : null)
|
||||
->set('article:published_time', $this->published->format('r'))
|
||||
->set('article:modified_time', $this->edited ? $this->edited->format('r') : null)
|
||||
;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$hasImages = isset($this->images) && count($this->images) > 0;
|
||||
$maxLength = $hasImages ? 200 : 500;
|
||||
return '<p class="news-excerpt ' . ($hasImages ? 'short' : 'long') . '">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class NewsRegion {
|
||||
public $title;
|
||||
public $slug;
|
||||
|
||||
public function __construct($title, $slug = null) {
|
||||
$this->title = $title;
|
||||
$this->slug = $slug ? $slug : strtolower(str_replace(' ', '', $title));
|
||||
}
|
||||
}
|
||||
|
||||
class NewsSource {
|
||||
public $title;
|
||||
public $url;
|
||||
public $show;
|
||||
|
||||
public function __construct($title, $url, $show) {
|
||||
$this->title = $title;
|
||||
$this->url = $url;
|
||||
$this->show = $show;
|
||||
}
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
require_once "NewsImage.php";
|
||||
|
||||
class Podcast extends Model {
|
||||
public $id;
|
||||
public $title;
|
||||
public $content;
|
||||
protected $soundfilename;
|
||||
public $created;
|
||||
public $program;
|
||||
public $url;
|
||||
public $auth;
|
||||
public $download;
|
||||
public $duration;
|
||||
public $image;
|
||||
public $metadata;
|
||||
public $waveform;
|
||||
private $key;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->created);
|
||||
|
||||
$this->url = '/' . $this->id . '/' . parent::url_slug($this->title) . '.mp3';
|
||||
if($this->soundfilename) {
|
||||
// Only generate when not constructing from a JSON object
|
||||
$this->key = sha1($this->id . ':' . date('Y-m-d') . ':' . $this->soundfilename);
|
||||
$this->auth = $this->key;
|
||||
}
|
||||
|
||||
if(isset($data->program)) {
|
||||
$this->program = null;
|
||||
if(is_object($data->program)) {
|
||||
$this->program = new \Model\Program($data->program);
|
||||
} elseif($data->program) {
|
||||
$this->program = new \Model\Program(['id' => $data->program, 'name' => $data->program_name, 'description' => $data->program_description]);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->imagefile)) {
|
||||
$imagedata = new \stdClass();
|
||||
$imagedata->id = $this->id;
|
||||
$imagedata->file = $data->imagefile;
|
||||
$imagedata->title = $data->imagecaption;
|
||||
$this->image = new NewsImage($imagedata, '/img/podcast/');
|
||||
}
|
||||
|
||||
if(isset($data->metadata, $data->metadata->waveform)){
|
||||
$this->waveform = $data->metadata->waveform;
|
||||
}
|
||||
|
||||
$this->metadata = (new MetaData())
|
||||
->set('title', $this->title)
|
||||
->set('description', strip_tags($this->excerpt()))
|
||||
->set('image', isset($this->image) ? $this->image->url : null )
|
||||
->set('audio', $this->url)
|
||||
;
|
||||
}
|
||||
|
||||
public function titleWithoutProgram() {
|
||||
if(!$this->program) { return $this->title; }
|
||||
return trim(str_replace($this->program->name, '', $this->title), "- \t\n\r\0\x0B");
|
||||
}
|
||||
|
||||
public function isValidAuth($key) {
|
||||
return ($key == $this->key);
|
||||
}
|
||||
|
||||
public function getSoundfile() {
|
||||
return '/var/audio/podcast/' . $this->soundfilename;
|
||||
}
|
||||
|
||||
public function formatDuration() {
|
||||
$seconds = $this->duration / 1000;
|
||||
$milliseconds = $this->duration % 1000;
|
||||
|
||||
$hours = ($seconds > 3600) ? floor($seconds / 3600) : 0;
|
||||
$seconds %= 3600;
|
||||
return str_pad($hours, 2, '0', STR_PAD_LEFT)
|
||||
. gmdate(':i:s', $seconds)
|
||||
;//. ($milliseconds ? ".$milliseconds" : '') ;
|
||||
}
|
||||
|
||||
public function excerpt() {
|
||||
$maxLength = 500;
|
||||
return '<p class="news-excerpt long">' .
|
||||
substr($this->content, 0, $maxLength) .
|
||||
(strlen($this->content) > $maxLength ? '...' : '') .
|
||||
'</p>';
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Program extends Model {
|
||||
public $id;
|
||||
public $name;
|
||||
public $tagline;
|
||||
public $description;
|
||||
public $email;
|
||||
public $nonstop;
|
||||
public $rerun;
|
||||
public $priority;
|
||||
public $image;
|
||||
|
||||
public $hosts;
|
||||
public $recent;
|
||||
public $next;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
|
||||
if(isset($data->suffix) && $data->suffix) {
|
||||
$this->name .= ' ' . $data->suffix;
|
||||
}
|
||||
|
||||
if($this->recent && $this->recent) {
|
||||
foreach($this->recent as &$recent) {
|
||||
parent::ConvertToDateTime($recent->starts);
|
||||
parent::ConvertToDateTime($recent->ends);
|
||||
}
|
||||
}
|
||||
if($this->next && $this->next) {
|
||||
foreach($this->next as &$next) {
|
||||
parent::ConvertToDateTime($next->starts);
|
||||
parent::ConvertToDateTime($next->ends);
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($data->email) && ($mailComma = strpos($data->email, ',')) !== false) {
|
||||
$this->email = substr($data->email, 0, $mailComma);
|
||||
}
|
||||
|
||||
if(isset($data->state)) {
|
||||
$this->nonstop = $data->state == 0;
|
||||
$this->rerun = $data->state == 3;
|
||||
}
|
||||
|
||||
$this->url = "/{$this->id}/" . parent::url_slug($this->name);
|
||||
}
|
||||
|
||||
public function isSpecial() {
|
||||
return ($this->priority < 2);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class ProgramHost extends Model {
|
||||
public $id;
|
||||
public $name;
|
||||
public $email;
|
||||
}
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Model;
|
||||
|
||||
class Track extends Model {
|
||||
public $start;
|
||||
public $itemCode;
|
||||
public $title;
|
||||
public $artist;
|
||||
public $duration;
|
||||
public $ends;
|
||||
public $isLayout;
|
||||
|
||||
public function __construct($data) {
|
||||
parent::__construct($data);
|
||||
parent::ConvertToDateTime($this->start);
|
||||
parent::ConvertToDateTime($this->ends);
|
||||
$isLayout = $this->isLayout();
|
||||
}
|
||||
|
||||
private static $IDENTS = ['UURSLUITER' => 'Nieuws', 'NIEUWSOPEN ' => 'Nieuws', 'ANWB' => 'Verkeersinformatie', 'REGIO' => 'Regionieuws', 'CB' => 'Reclame'];
|
||||
|
||||
public function isLayout() {
|
||||
foreach(self::$IDENTS as $ident => $display) {
|
||||
if(substr($this->itemCode, 0, strlen($ident)) == $ident || substr($this->title, 0, strlen($ident)) == $ident) {
|
||||
$this->title = $display;
|
||||
$this->artist = "";
|
||||
$this->itemCode = '_' . $this->itemCode;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen($this->itemCode) > 0 && ($this->itemCode[0] == 'V')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function ends($ends = null) {
|
||||
$this->ends = $ends;
|
||||
}
|
||||
|
||||
public function secondsRemaining() {
|
||||
return ($this->ends) ? ($this->ends->getTimestamp() - time()) : -1;
|
||||
}
|
||||
}
|
||||
0
app/Providers/AppServiceProvider.php
Executable file → Normal file
0
app/Providers/AuthServiceProvider.php
Executable file → Normal file
0
app/Providers/BroadcastServiceProvider.php
Executable file → Normal file
0
app/Providers/EventServiceProvider.php
Executable file → Normal file
0
app/Providers/RouteServiceProvider.php
Executable file → Normal file
0
app/User.php
Executable file → Normal file
0
bootstrap/app.php
Executable file → Normal file
0
bootstrap/autoload.php
Executable file → Normal file
0
bootstrap/cache/.gitignore
vendored
Executable file → Normal file
2
composer.json
Executable file → Normal file
@@ -27,7 +27,7 @@
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/",
|
||||
"Helpers\\": "app/Helpers",
|
||||
"Model\\": "app/Models"
|
||||
"Model\\": "/srv/api/common/classes"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
|
||||
0
composer.lock
generated
Executable file → Normal file
0
config/app.php
Executable file → Normal file
0
config/auth.php
Executable file → Normal file
0
config/broadcasting.php
Executable file → Normal file
0
config/cache.php
Executable file → Normal file
0
config/database.php
Executable file → Normal file
12
config/filesystems.php
Executable file → Normal file
@@ -48,12 +48,12 @@ return [
|
||||
'root' => storage_path('app'),
|
||||
],
|
||||
|
||||
//'public' => [
|
||||
// 'driver' => 'local',
|
||||
// 'root' => storage_path('app/public'),
|
||||
// 'url' => env('APP_URL').'/storage',
|
||||
// 'visibility' => 'public',
|
||||
//],
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
|
||||
0
config/mail.php
Executable file → Normal file
0
config/queue.php
Executable file → Normal file
0
config/services.php
Executable file → Normal file
0
config/session.php
Executable file → Normal file
0
config/view.php
Executable file → Normal file
0
database/.gitignore
vendored
Executable file → Normal file
0
database/factories/ModelFactory.php
Executable file → Normal file
0
database/migrations/2014_10_12_000000_create_users_table.php
Executable file → Normal file
0
database/migrations/2014_10_12_100000_create_password_resets_table.php
Executable file → Normal file
0
database/migrations/2024_02_27_000000_create_pagestats_table.php
Executable file → Normal file
0
database/seeds/DatabaseSeeder.php
Executable file → Normal file
0
docker-compose.dev.yml
Executable file → Normal file
0
docker-compose.yml
Executable file → Normal file
0
docker/apache.conf
Executable file → Normal file
0
docker/apache.dev.conf
Executable file → Normal file
0
download_mediaplayer_plugins.php
Executable file → Normal file
0
env.example
Executable file → Normal file
0
package-lock.json
generated
Executable file → Normal file
0
package.json
Executable file → Normal file
0
phpunit.xml
Executable file → Normal file
0
public/.htaccess
Executable file → Normal file
0
public/android-chrome-192x192.png
Executable file → Normal file
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
0
public/android-chrome-512x512.png
Executable file → Normal file
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
0
public/apple-touch-icon.png
Executable file → Normal file
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
0
public/css/airplay.png
Executable file → Normal file
|
Before Width: | Height: | Size: 606 B After Width: | Height: | Size: 606 B |
0
public/css/airplay.svg
Executable file → Normal file
|
Before Width: | Height: | Size: 417 B After Width: | Height: | Size: 417 B |
0
public/css/app.css
vendored
Executable file → Normal file
0
public/css/app.css.map
Executable file → Normal file
0
public/css/bootstrap-grid.css
vendored
Executable file → Normal file
0
public/css/bootstrap-grid.css.map
Executable file → Normal file
0
public/css/bootstrap-grid.min.css
vendored
Executable file → Normal file
0
public/css/bootstrap-grid.min.css.map
Executable file → Normal file
0
public/css/chromecast.png
Executable file → Normal file
|
Before Width: | Height: | Size: 951 B After Width: | Height: | Size: 951 B |
0
public/css/chromecast.svg
Executable file → Normal file
|
Before Width: | Height: | Size: 637 B After Width: | Height: | Size: 637 B |
0
public/css/components/posts.css.map
Executable file → Normal file
0
public/css/components/pretty_photo.css.map
Executable file → Normal file
0
public/css/images/ui-bg_flat_0_aaaaaa_40x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
0
public/css/images/ui-bg_flat_0_eeeeee_40x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 274 B |
0
public/css/images/ui-bg_flat_55_ffffff_40x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
0
public/css/images/ui-bg_flat_75_ffffff_40x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
0
public/css/images/ui-bg_glass_65_ffffff_1x400.png
Executable file → Normal file
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
0
public/css/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
0
public/css/images/ui-bg_highlight-soft_25_0073ea_1x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 387 B |
0
public/css/images/ui-bg_highlight-soft_50_dddddd_1x100.png
Executable file → Normal file
|
Before Width: | Height: | Size: 407 B After Width: | Height: | Size: 407 B |