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