use \OCP\AppFramework\Controller;
use \OCP\AppFramework\Http\TemplateResponse;
use \OCA\Grauphel\Lib\Client;
+use \OCA\Grauphel\Lib\Dependencies;
use \OCA\Grauphel\Lib\TokenStorage;
use \OCA\Grauphel\Lib\Response\ErrorResponse;
public function __construct($appName, \OCP\IRequest $request, $user)
{
parent::__construct($appName, $request);
- $this->user = $user;
+ $this->user = $user;
+ $this->deps = Dependencies::get();
//default http header: we assume something is broken
header('HTTP/1.0 500 Internal Server Error');
//head
$xw->startElement('head');
- $xw->writeElement('title', $note->title);
+ $xw->writeElement(
+ 'title',
+ htmlspecialchars_decode($note->title, ENT_QUOTES | ENT_HTML5)
+ );
$xw->startElement('meta');
$xw->writeAttribute('name', 'author');
//body
$xw->startElement('body');
-
- $xw->writeElement('h1', $note->title);
+ $xw->writeElement(
+ 'h1', htmlspecialchars_decode($note->title, ENT_QUOTES | ENT_HTML5)
+ );
$converter = new \OCA\Grauphel\Converter\CleanHtml();
$converter->internalLinkHandler = array($this, 'htmlNoteLinkHandler');
$converter = new \OCA\Grauphel\Converter\ReStructuredText();
$converter->internalLinkHandler = array($this, 'textNoteLinkHandler');
try {
- $text = $note->title . "\n"
- . str_repeat('*', strlen($note->title)) . "\n"
+ $title = htmlspecialchars_decode($note->title, ENT_QUOTES | ENT_HTML5);
+ $text = $title . "\n"
+ . str_repeat('*', strlen($title)) . "\n"
. "\n";
$text .= $converter->convert($note->{'note-content'});
return new \OCA\Grauphel\Response\TextResponse($text);
protected function getNotes()
{
$username = $this->user->getUid();
- $notes = new \OCA\Grauphel\Lib\NoteStorage($this->urlGen);
+ $notes = new \OCA\Grauphel\Lib\NoteStorage($this->deps->urlGen);
$notes->setUsername($username);
return $notes;
}