X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/fff5bbcee458992443e3732fbcbbbe34f765fcc3..refs/pull/474/head:/app/Book.php diff --git a/app/Book.php b/app/Book.php index aa2dee9c0..06c00945d 100644 --- a/app/Book.php +++ b/app/Book.php @@ -13,9 +13,9 @@ class Book extends Entity public function getUrl($path = false) { if ($path !== false) { - return baseUrl('/books/' . $this->slug . '/' . trim($path, '/')); + return baseUrl('/books/' . urlencode($this->slug) . '/' . trim($path, '/')); } - return baseUrl('/books/' . $this->slug); + return baseUrl('/books/' . urlencode($this->slug)); } /* @@ -56,4 +56,13 @@ class Book extends Entity return strlen($description) > $length ? substr($description, 0, $length-3) . '...' : $description; } + /** + * Return a generalised, common raw query that can be 'unioned' across entities. + * @return string + */ + public function entityRawQuery() + { + return "'BookStack\\\\Book' as entity_type, id, id as entity_id, slug, name, {$this->textField} as text,'' as html, '0' as book_id, '0' as priority, '0' as chapter_id, '0' as draft, created_by, updated_by, updated_at, created_at"; + } + }