Codestyle + check trustedproxies
[dokuwiki.git] / inc / Action / Preview.php
blob7ab6941df40c0f45702235d749a89ed3d851ea0e
1 <?php
3 namespace dokuwiki\Action;
5 use dokuwiki\Ui\Editor;
6 use dokuwiki\Ui\PageView;
7 use dokuwiki\Draft;
8 use dokuwiki\Ui;
10 /**
11 * Class Preview
13 * preview during editing
15 * @package dokuwiki\Action
17 class Preview extends Edit
19 /** @inheritdoc */
20 public function preProcess()
22 header('X-XSS-Protection: 0');
23 $this->savedraft();
24 parent::preProcess();
27 /** @inheritdoc */
28 public function tplContent()
30 global $TEXT;
31 (new Editor())->show();
32 (new PageView($TEXT))->show();
35 /**
36 * Saves a draft on preview
38 protected function savedraft()
40 global $ID, $INFO;
41 $draft = new Draft($ID, $INFO['client']);
42 if (!$draft->saveDraft()) {
43 $errors = $draft->getErrors();
44 foreach ($errors as $error) {
45 msg(hsc($error), -1);