xref: /plugin/siteexport/exe/siteexportmanager.php (revision b325f6faa1ffba30260caf523abae595fddabb10)
1<?php
2/**
3 * Siteexport Manager Popup
4 *
5 * based up on the mediamanager popup
6 *
7 * @author   Gerry Weissbach / i-net software <gweissbach@inetsoftware.de>
8 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
9 */
10if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../../');
11define('DOKU_SITEEXPORT_MANAGER',1);
12
13    require_once(DOKU_INC.'inc/init.php');
14
15    global $INFO, $JSINFO, $INPUT, $ID, $conf;
16
17    $NS = cleanID($INPUT->str('ns'));
18
19    if ( empty($ID) ) {
20    	if ( empty($conf['basedir']) ) {
21
22    		$path = str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, dirname(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)).'/../../../../');
23		    $parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
24		    $absolutes = array();
25		    foreach ($parts as $part) {
26		        if ('.'  == $part) continue;
27		        if ('..' == $part) {
28		            array_pop($absolutes);
29		        } else {
30		            $absolutes[] = $part;
31		        }
32		    }
33		    $conf['basedir']='/'.implode(DIRECTORY_SEPARATOR, $absolutes);
34    	}
35
36    	$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_REFERER'];
37    	$ID = $NS . ':' . getID();
38    }
39
40    $INFO = !empty($INFO) ? array_merge($INFO, mediainfo()) : mediainfo();
41    $JSINFO = array('id' => $ID, 'namespace' => $NS);
42    $AUTH = $INFO['perm'];    // shortcut for historical reasons
43
44    // do not display the manager if user does not have read access
45    if($AUTH < AUTH_READ) {
46       	http_status(403);
47        die($lang['accessdenied']);
48    }
49
50    header('Content-Type: text/html; charset=utf-8');
51?><!DOCTYPE html>
52<html lang="<?php echo $conf['lang']?>" dir="<?php echo $lang['direction'] ?>" class="popup no-js">
53<head>
54    <meta charset="utf-8" />
55    <title>
56        <?php echo hsc($lang['mediaselect'])?>
57        [<?php echo strip_tags($conf['title'])?>]
58    </title>
59    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
60    <?php tpl_metaheaders()?>
61    <meta name="viewport" content="width=device-width,initial-scale=1" />
62    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
63    <?php tpl_includeFile('meta.html') ?>
64</head>
65
66<body>
67    <!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]-->
68    <div id="siteexport__manager" class="dokuwiki">
69        <?php html_msgarea() ?>
70        <?php
71			$functions=& plugin_load('helper', 'siteexport');
72			$functions->__siteexport_addpage();
73        ?>
74    </div>
75    <!--[if ( lte IE 7 | IE 8 ) ]></div><![endif]-->
76</body>
77</html>
78
79<?php
80/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */