]> BookStack Code Mirror - bookstack/commitdiff
Merge pull request #63 from AkibaWolf/patch-1
authorDan Brown <redacted>
Sat, 20 Feb 2016 19:24:32 +0000 (19:24 +0000)
committerDan Brown <redacted>
Sat, 20 Feb 2016 19:24:32 +0000 (19:24 +0000)
Fixes encoding issues the page HTML is formatted on save

1  2 
app/Repos/PageRepo.php

diff --combined app/Repos/PageRepo.php
index 25b869bc380c23261e373d0a58e12e30ddbc41b8,93f80ec6d513a803c937d9dc422652fd609e00cf..1acf3c84703db2e4216077048228a332ec888624
@@@ -125,7 -125,7 +125,7 @@@ class PageRep
          if($htmlText == '') return $htmlText;
          libxml_use_internal_errors(true);
          $doc = new \DOMDocument();
-         $doc->loadHTML($htmlText);
+         $doc->loadHTML(mb_convert_encoding($htmlText, 'HTML-ENTITIES', 'UTF-8'));
  
          $container = $doc->documentElement;
          $body = $container->childNodes->item(0);
          $page->delete();
      }
  
 +    /**
 +     * Get the latest pages added to the system.
 +     * @param $count
 +     */
 +    public function getRecentlyCreatedPaginated($count = 20)
 +    {
 +        return $this->page->orderBy('created_at', 'desc')->paginate($count);
 +    }
 +
 +    /**
 +     * Get the latest pages added to the system.
 +     * @param $count
 +     */
 +    public function getRecentlyUpdatedPaginated($count = 20)
 +    {
 +        return $this->page->orderBy('updated_at', 'desc')->paginate($count);
 +    }
  
- }
+ }