xref: /plugin/siteexport/inc/settings.php (revision c8022393a788336b3033a14a62c9bbad812c4521)
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 = false;
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    function settings_plugin_siteexport_settings($functions) {
35        global $ID;
36
37        $functions->debug->setDebugFile ($this->getConf('debugFile'));
38        if ( !empty( $_REQUEST['debug'] ) && intval($_REQUEST['debug']) >= 0 && intval($_REQUEST['debug']) <= 5) {
39            $functions->debug->setDebugLevel(intval($_REQUEST['debug']));
40        } else
41        {
42    		$functions->debug->setDebugLevel($this->getConf('debugLevel'));
43        }
44
45        $functions->debug->isAJAX = $this->getConf('ignoreAJAXError') ? false : $functions->debug->isAJAX;
46
47        if ( empty($_REQUEST['pattern']) )
48        {
49            $params = $_REQUEST;
50            $this->pattern = $functions->requestParametersToCacheHash($params);
51        } else {
52            // Set the pattern
53            $this->pattern = $_REQUEST['pattern'];
54        }
55
56        $this->isCLI = (!$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name());
57
58        $this->cachetime = $this->getConf('cachetime');
59        if ( !empty( $_REQUEST['disableCache'] ) ) {
60	        $this->cachetime = intval($_REQUEST['disableCache']) == 1 ? 0 : $this->cachetime;
61        }
62
63        // Load Variables
64        $this->origZipFile = $this->getConf('zipfilename');
65
66        $this->ignoreNon200 = $this->getConf('ignoreNon200');
67
68        // ID
69        $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern);
70        //        $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern);
71
72        $this->zipFile = mediaFN($this->downloadZipFile);
73
74        $this->tmpDir = mediaFN(getNS($this->origZipFile));
75        $this->exportLinkedPages = intval($_REQUEST['exportLinkedPages']) == 1 ? true : false;
76
77        $this->namespace = $functions->getNamespaceFromID($_REQUEST['ns'], $PAGE);
78        $this->addParams = !empty($_REQUEST['addParams']);
79
80        $this->useTOCFile = !empty($_REQUEST['useTocFile']);
81
82        // set export Namespace - which is a virtual Root
83        $pg = noNS($ID);
84        if ( empty( $this->namespace ) ) { $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg); }
85        $this->exportNamespace = !empty($_REQUEST['ens']) && preg_match("%^" . preg_quote($functions->getNamespaceFromID($_REQUEST['ens'], $pg), '%') . "%", $this->namespace) ? $functions->getNamespaceFromID($_REQUEST['ens'], $pg) : $this->namespace;
86
87        $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false;
88
89        // Strip params that should be forwarded
90        $this->additionalParameters = $_REQUEST;
91        $functions->removeWikiVariables($this->additionalParameters, true);
92    }
93}
94
95?>