xref: /plugin/siteexport/inc/settings.php (revision 35277e0d14ba9e1e5b2244a072a16632b5d7248a)
1<?php
2
3if(!defined('DOKU_PLUGIN')) die('meh');
4class settings_plugin_siteexport_settings extends DokuWiki_Plugin
5{
6    var $fileType = 'html';
7    var $exportNamespace = '';
8    var $pattern = null;
9
10    var $isCLI = false;
11
12    var $depth = '';
13
14    var $zipFile = '';
15//    var $origEclipseZipFile = 'doc.zip';
16//    var $eclipseZipFile = '';
17    var $addParams = false;
18    var $origZipFile = '';
19    var $downloadZipFile = '';
20    var $exportLinkedPages = true;
21    var $additionalParameters = array();
22    var $isAuthed = false;
23
24    var $TOCMapWithoutTranslation = false;
25
26    var $cachetime = 0;
27    var $hasValidCacheFile = false;
28
29    var $useTOCFile = false;
30    var $cookie = null;
31
32    var $ignoreNon200 = true;
33
34    var $defaultLang = 'en';
35
36    function settings_plugin_siteexport_settings($functions) {
37        global $ID, $conf;
38
39        $functions->debug->setDebugFile ($this->getConf('debugFile'));
40        if ( !empty( $_REQUEST['debug'] ) && intval($_REQUEST['debug']) >= 0 && intval($_REQUEST['debug']) <= 5) {
41            $functions->debug->setDebugLevel(intval($_REQUEST['debug']));
42        } else
43        {
44    		$functions->debug->setDebugLevel($this->getConf('debugLevel'));
45        }
46
47        $functions->debug->isAJAX = $this->getConf('ignoreAJAXError') ? false : $functions->debug->isAJAX;
48
49        if ( empty($_REQUEST['pattern']) )
50        {
51            $params = $_REQUEST;
52            $this->pattern = $functions->requestParametersToCacheHash($params);
53        } else {
54            // Set the pattern
55            $this->pattern = $_REQUEST['pattern'];
56        }
57
58        $this->isCLI = (!$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name());
59
60        $this->cachetime = $this->getConf('cachetime');
61        if ( !empty( $_REQUEST['disableCache'] ) ) {
62	        $this->cachetime = intval($_REQUEST['disableCache']) == 1 ? 0 : $this->cachetime;
63        }
64
65        // Load Variables
66        $this->origZipFile = $this->getConf('zipfilename');
67
68        $this->ignoreNon200 = $this->getConf('ignoreNon200');
69
70        // ID
71        $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
72        //        $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
73
74        $this->zipFile = mediaFN($this->downloadZipFile);
75
76        $this->tmpDir = mediaFN(getNS($this->origZipFile));
77        $this->exportLinkedPages = !isset($_REQUEST['exportLinkedPages']) || intval($_REQUEST['exportLinkedPages']) == 1 ? true : false;
78
79        $this->namespace = $functions->getNamespaceFromID($_REQUEST['ns'], $PAGE);
80        $this->addParams = !empty($_REQUEST['addParams']);
81
82        $this->useTOCFile = !empty($_REQUEST['useTocFile']);
83
84        // set export Namespace - which is a virtual Root
85        $pg = noNS($ID);
86        if ( empty( $this->namespace ) ) { $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg); }
87        $this->exportNamespace = !empty($_REQUEST['ens']) && preg_match("%^" . preg_quote($functions->getNamespaceFromID($_REQUEST['ens'], $pg), '%') . "%", $this->namespace) ? $functions->getNamespaceFromID($_REQUEST['ens'], $pg) : $this->namespace;
88
89        $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
90
91        $this->defaultLang = empty($_REQUEST['defaultLang']) ? $conf['lang'] : $_REQUEST['defaultLang'];
92
93        // Strip params that should be forwarded
94        $this->additionalParameters = $_REQUEST;
95        $functions->removeWikiVariables($this->additionalParameters, true);
96    }
97}
98
99?>