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