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