-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsource.php
33 lines (30 loc) · 948 Bytes
/
source.php
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
<?php
/**
* source.php - return source of page as text file
*
* @copyright Copyright © 2013 geekwright, LLC. All rights reserved.
* @license gwiki/docs/license.txt GNU General Public License (GPL)
* @since 1.0
* @author Richard Griffith <[email protected]>
* @package gwiki
*/
include __DIR__ . '/../../mainfile.php';
$xoopsLogger->activated = false;
include_once __DIR__ . '/include/functions.php';
global $wikiPage;
if (isset($_GET['page'])) {
$page = $wikiPage->normalizeKeyword(cleaner($_GET['page']));
$pageX = $wikiPage->getPage($page);
} else {
$page = false;
$pageX = false;
}
if ($page && $pageX) {
header('Content-type: text/plain');
header('Content-Disposition: inline; filename="' . $page . '.txt"');
echo $wikiPage->body;
echo "\r\n";
} else {
redirect_header(sprintf($wikiPage->getWikiLinkURL(), $wikiPage->wikiHomePage), 2, _MD_GWIKI_PAGENOTFOUND_ERR);
}
exit;