/usr/share/horde/wicked/display.php is in php-horde-wicked 2.0.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | <?php
/**
* Copyright 2003-2016 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Tyler Colbert <tyler@colberts.us>
*/
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('wicked');
$actionID = Horde_Util::getFormData('actionID');
try {
$page = Wicked_Page::getCurrentPage();
} catch (Wicked_Exception $e) {
$notification->push(_("Internal error viewing requested page"), 'horde.error');
$page = Wicked_Page::getPage('');
$actionID = null;
}
switch ($actionID) {
case 'lock':
if (!$page->allows(Wicked::MODE_LOCKING)) {
$notification->push(_("You are not allowed to lock this page"),
'horde.error');
break;
}
try {
$result = $page->lock();
} catch (Wicked_Exception $e) {
$notification->push(sprintf(_("Page failed to lock: %s"), $e->getMessage()),
'horde.error');
}
break;
case 'unlock':
if (!$page->allows(Wicked::MODE_UNLOCKING)) {
$notification->push(_("You are not allowed to unlock this page"),
'horde.error');
}
try {
$result = $page->unlock();
$notification->push(_("Page unlocked"), 'horde.success');
} catch (Wicked_Exception $e) {
$notification->push(
sprintf(_("Page failed to unlock: %s"), $e->getMessage()),
'horde.error');
}
break;
case 'history':
if ($page->allows(Wicked::MODE_HISTORY)) {
/* Redirect to history page. */
Horde::url('history.php')
->add('page', $page->pageName())
->redirect();
}
$notification->push(_("This page does not have a history"), 'horde.error');
break;
case 'special':
$page->handleAction();
break;
case 'export':
if (!$page->allows(Wicked::MODE_DISPLAY)) {
$notification->push(_("You don't have permission to view this page."),
'horde.error');
if ($page->pageName() == 'Wiki/Home') {
throw new Horde_Exception(_("You don't have permission to view this page."));
}
Wicked::url('Wiki/Home', true)->redirect();
}
switch (Horde_Util::getGet('format')) {
case 'html':
$format = 'Xhtml';
$ext = '.html';
$mime = 'text/html';
break;
case 'tex':
$format = 'Latex';
$ext = '.tex';
$mime = 'text/x-tex';
break;
case 'rst':
$format = 'Rst';
$ext = '';
$mime = 'text/text';
break;
case 'plain':
default:
$format = 'Plain';
$ext = '.txt';
$mime = 'text/text';
break;
}
$wiki = $page->getProcessor($format);
try {
$text = $wiki->transform($page->getText(), $format);
$browser->downloadHeaders($page->pageTitle() . $ext, $mime, false, strlen($text));
echo $text;
exit;
} catch (Wicked_Exception $e) {
$notification->push($e);
}
break;
default:
$wicked->logPageView($page->pageName());
break;
}
if (!$page->allows(Wicked::MODE_DISPLAY)) {
if ($page->pageName() == 'Wiki/Home') {
throw new Wicked_Exception(_("You don't have permission to view this page."));
}
$notification->push(_("You don't have permission to view this page."),
'horde.error');
$page = Wicked_Page::getPage('');
}
$params = Horde_Util::getFormData(
'params',
Horde_Util::getFormData('searchfield')
);
$page->preDisplay(Wicked::MODE_DISPLAY, $params);
if ($page->isLocked()) {
$notification->push(sprintf(_("This page is locked by %s for %d Minutes."), $page->getLockRequestor(), $page->getLockTime()), 'horde.message');
}
$history = $session->get('wicked', 'history', Horde_Session::TYPE_ARRAY);
Horde::startBuffer();
echo $page->render(Wicked::MODE_DISPLAY, $params);
$content = Horde::endBuffer();
Wicked::addFeedLink();
Wicked::setTopbar();
$page_output->header(array(
'title' => $page->pageTitle()
));
$notification->notify(array('listeners' => 'status'));
echo $content;
$page_output->footer();
if ($page instanceof Wicked_Page_StandardPage &&
(!isset($history[0]) ||
$history[0] != $page->pageName())) {
array_unshift($history, $page->pageName());
$session->set('wicked', 'history', $history);
}
if (count($history) > 10) {
array_pop($history);
$session->set('wicked', 'history', $history);
}
|