diff --git a/app/Http/Controllers/DashController.php b/app/Http/Controllers/DashController.php index 9f652b2..e6a0925 100644 --- a/app/Http/Controllers/DashController.php +++ b/app/Http/Controllers/DashController.php @@ -88,7 +88,7 @@ class DashController extends Controller $title; $page = []; $views = []; - $mode == 'edit' ? $page = $this->pages->getById($uuid) : $page = []; + $mode == 'edit' ? $page = $this->pages->getByUuid($uuid) : $page = []; $mode == 'edit' ? $title = $page['title'] : $title = 'Add New'; $mode == 'edit' ? $views = $this->themes->getCustomViews($page['layout']) : $views[] = 'page'; diff --git a/app/Http/Controllers/ThemeController.php b/app/Http/Controllers/ThemeController.php index 18edc37..4dd59e5 100644 --- a/app/Http/Controllers/ThemeController.php +++ b/app/Http/Controllers/ThemeController.php @@ -56,14 +56,14 @@ class ThemeController extends Controller $page; if ($view == 'index') { $template = $currentTheme . '.index'; - $page = $this->pages->getBySlug('first'); + $page = $this->pages->getById(0); } else { $template = $currentTheme . '.page'; //if coming from theme page, grabs id of latest page if ($id == null) { - $id = $this->getPageID(); + $uuid = $this->getPageUUID(); } - $page = $this->pages->getById($id); + $page = $this->pages->getByUuid($uuid); } $pageData = $this->sort->page($page); break; @@ -88,7 +88,7 @@ class ThemeController extends Controller } } - private function getPageID() + private function getPageUUID() { $book = $this->pages->getAll(); $page = $book->where('layout', 'page')->first(); diff --git a/app/Interfaces/PageRepositoryInterface.php b/app/Interfaces/PageRepositoryInterface.php index 47b4163..5454897 100644 --- a/app/Interfaces/PageRepositoryInterface.php +++ b/app/Interfaces/PageRepositoryInterface.php @@ -6,7 +6,9 @@ interface PageRepositoryInterface { public function getAll(); - public function getByID($uuid); + public function getById($id); + + public function getByUuid($uuid); public function getBySlug($slug); diff --git a/app/Repositories/PageRepository.php b/app/Repositories/PageRepository.php index fb6cc81..df04577 100644 --- a/app/Repositories/PageRepository.php +++ b/app/Repositories/PageRepository.php @@ -45,7 +45,15 @@ class PageRepository implements PageRepositoryInterface return $this->pages; } - public function getById($uuid) + public function getById($id) + { + $page = $this->pages->where('id', $id)->first(); + //quick check to see if layout is set + $page['layout'] == '' ? $page['layout'] = 'page' : $page['layout'] = $page['layout']; + return $page; + } + + public function getByUuid($uuid) { $page = $this->pages->where('uuid', $uuid)->first(); //quick check to see if layout is set @@ -121,6 +129,7 @@ class PageRepository implements PageRepositoryInterface $id = $task != 'create' ? $body->id : $this->settings->getSettings()['library_stats']['current_index']; $uuid = $task != 'create' ? $body->uuid : createUUID(); //set variables post body for saving + $body->title = urlencode($body->title); $body->id = $id; $body->uuid = $uuid; $body->path = $path; diff --git a/app/Services/Data/SortingService.php b/app/Services/Data/SortingService.php index 094c3f6..fd701e3 100644 --- a/app/Services/Data/SortingService.php +++ b/app/Services/Data/SortingService.php @@ -216,7 +216,7 @@ class SortingService array_push($recent, [ 'path' => $item['path'], 'slug' => $item['slug'], - 'title' => $item['title'], + 'title' => urldecode($item['title']), 'feature' => $item['feature'], ]); } @@ -226,7 +226,7 @@ class SortingService array_push($featured, [ 'path' => $item['path'], 'slug' => $item['slug'], - 'title' => $item['title'], + 'title' => urldecode($item['title']), 'feature' => $item['feature'], ]); } @@ -237,7 +237,7 @@ class SortingService "debug" => $debug, "theme" => $this->info['theme'], "status" => session('member') != null ? true : false, - "title" => $page['title'], + "title" => urldecode($page['title']), "meta" => $meta, "menu" => $this->settings->getMenu(), "info" => $this->info, diff --git a/app/Services/Upkeep/InitService.php b/app/Services/Upkeep/InitService.php index 41cde58..17a6e09 100644 --- a/app/Services/Upkeep/InitService.php +++ b/app/Services/Upkeep/InitService.php @@ -88,7 +88,7 @@ class InitService //create index file //TODO: upate path attribute to use env variable $index = [ - 'id' => 1, + 'id' => 0, 'uuid' => createUUID(), 'title' => 'FIRST!', 'imageList' => '/assets/images/global/default-bg.jpg', diff --git a/resources/views/back/page.blade.php b/resources/views/back/page.blade.php index 7e0ae69..db7454c 100644 --- a/resources/views/back/page.blade.php +++ b/resources/views/back/page.blade.php @@ -1,8 +1,7 @@ @extends('frame') -@section('title', 'The Dash | Editing '. $title) - @php + $title = urldecode($title); if($mode == 'edit') { $id = $page['id']; @@ -30,6 +29,7 @@ $files = ""; } @endphp + @section('title', 'The Dash | Editing '. $title) @section('main-content')
diff --git a/resources/views/includes/recent-meta.blade.php b/resources/views/includes/recent-meta.blade.php index f60fad2..8bd1a81 100644 --- a/resources/views/includes/recent-meta.blade.php +++ b/resources/views/includes/recent-meta.blade.php @@ -29,7 +29,10 @@ if($page['featured'] == 'true')
- {{ $page['title'] }} + @php + $title = urldecode($page['title']); + @endphp + {{ $title }}