Statische pagina's via intranet
This commit is contained in:
0
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/LoginController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/LoginController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/RegisterController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/RegisterController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file → Executable file
0
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file → Executable file
0
app/Http/Controllers/CalendarController.php
Normal file → Executable file
0
app/Http/Controllers/CalendarController.php
Normal file → Executable file
71
app/Http/Controllers/Controller.php
Normal file → Executable file
71
app/Http/Controllers/Controller.php
Normal file → Executable file
@@ -22,14 +22,14 @@ class Controller extends BaseController
|
||||
$data = json_decode(Storage::disk('local')->get($file));
|
||||
foreach ($path as $subobject) {
|
||||
$data = $data->$subobject ?? [];
|
||||
}
|
||||
}
|
||||
$items = [];
|
||||
foreach ($data as $item_data) {
|
||||
$items[] = new $class($item_data);
|
||||
if ($maxItems && count($items) == $maxItems) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
@@ -72,8 +72,10 @@ 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'));
|
||||
@@ -84,8 +86,10 @@ 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'));
|
||||
->with(
|
||||
'podcasts',
|
||||
$this->getDataFromFileAndConvert('laatste_podcasts.json', ['podcasts'], '\Model\Podcast')
|
||||
);
|
||||
});
|
||||
|
||||
View::share('disableBanners', env('DISABLE_BANNERS', false));
|
||||
@@ -97,14 +101,16 @@ 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)
|
||||
@@ -115,14 +121,14 @@ class Controller extends BaseController
|
||||
"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"
|
||||
'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;
|
||||
//\dump($http_response_header);
|
||||
$result = @file_get_contents($this->API_URL . $url, false, stream_context_create($arrContextOptions));
|
||||
return $result ? json_decode($result) : null;
|
||||
}
|
||||
|
||||
protected function checkAPI($url)
|
||||
@@ -143,22 +149,22 @@ class Controller extends BaseController
|
||||
return is_object($obj) ? new \DateTime($obj->date, new \DateTimeZone($obj->timezone)) : \Carbon\Carbon::parse($obj)->setTimezone(date_default_timezone_get());
|
||||
}
|
||||
|
||||
public function __call($method, $arguments)
|
||||
{
|
||||
if (substr($method, 0, 5) == 'view_') {
|
||||
$view = substr($method, 5);
|
||||
if (view()->exists($view)) {
|
||||
return view($view);
|
||||
}
|
||||
}
|
||||
// public function __call($method, $arguments)
|
||||
// {
|
||||
// if (substr($method, 0, 5) == 'view_') {
|
||||
// $view = substr($method, 5);
|
||||
// if (view()->exists($view)) {
|
||||
// return view($view);
|
||||
// }
|
||||
// }
|
||||
|
||||
return abort(404);
|
||||
}
|
||||
// return abort(404);
|
||||
// }
|
||||
|
||||
public function getSidebareData()
|
||||
{
|
||||
$populair = [];
|
||||
$apiResult = $this->API('nieuws/populair?aantal=5');
|
||||
$apiResult = $this->API('nieuws/populair?aantal=5');
|
||||
foreach ($apiResult->news as $_newsItem) {
|
||||
$populair[] = new \Model\NewsItem($_newsItem);
|
||||
}
|
||||
@@ -171,4 +177,19 @@ class Controller extends BaseController
|
||||
|
||||
return ['newsItems' => $newsItems, 'populair' => $populair];
|
||||
}
|
||||
|
||||
public function static_page($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'));
|
||||
}
|
||||
}
|
||||
|
||||
0
app/Http/Controllers/HomeController.php
Normal file → Executable file
0
app/Http/Controllers/HomeController.php
Normal file → Executable file
0
app/Http/Controllers/ImagesController.php
Normal file → Executable file
0
app/Http/Controllers/ImagesController.php
Normal file → Executable file
0
app/Http/Controllers/JobsController.php
Normal file → Executable file
0
app/Http/Controllers/JobsController.php
Normal file → Executable file
0
app/Http/Controllers/KerkdienstController.php
Normal file → Executable file
0
app/Http/Controllers/KerkdienstController.php
Normal file → Executable file
0
app/Http/Controllers/NewsController.php
Normal file → Executable file
0
app/Http/Controllers/NewsController.php
Normal file → Executable file
0
app/Http/Controllers/PodcastController.php
Normal file → Executable file
0
app/Http/Controllers/PodcastController.php
Normal file → Executable file
0
app/Http/Controllers/RadioController.php
Normal file → Executable file
0
app/Http/Controllers/RadioController.php
Normal file → Executable file
0
app/Http/Controllers/SpecialController.php
Normal file → Executable file
0
app/Http/Controllers/SpecialController.php
Normal file → Executable file
0
app/Http/Controllers/StreamController.php
Normal file → Executable file
0
app/Http/Controllers/StreamController.php
Normal file → Executable file
0
app/Http/Kernel.php
Normal file → Executable file
0
app/Http/Kernel.php
Normal file → Executable file
0
app/Http/Middleware/EncryptCookies.php
Normal file → Executable file
0
app/Http/Middleware/EncryptCookies.php
Normal file → Executable file
0
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file → Executable file
0
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file → Executable file
0
app/Http/Middleware/TrimStrings.php
Normal file → Executable file
0
app/Http/Middleware/TrimStrings.php
Normal file → Executable file
0
app/Http/Middleware/VerifyCsrfToken.php
Normal file → Executable file
0
app/Http/Middleware/VerifyCsrfToken.php
Normal file → Executable file
Reference in New Issue
Block a user