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 $hasValidCacheFile = false; 27 28 var $useTOCFile = false; 29 30 function settings_plugin_siteexport_settings($functions) { 31 global $ID; 32 33 if ( empty($_REQUEST['pattern']) ) 34 { 35 $params = $_REQUEST; 36 $this->pattern = $functions->requestParametersToCacheHash($params); 37 } else { 38 // Set the pattern 39 $this->pattern = $_REQUEST['pattern']; 40 } 41 42 $this->isCLI = (!$_SERVER['REMOTE_ADDR'] && 'cli' == php_sapi_name()); 43 44 // Load Variables 45 $this->origZipFile = $this->getConf('zipfilename'); 46 47 // ID 48 $this->downloadZipFile = $functions->getSpecialExportFileName($this->origZipFile, $this->pattern); 49 // $this->eclipseZipFile = $functions->getSpecialExportFileName(getNS($this->origZipFile) . ':' . $this->origEclipseZipFile, $this->pattern); 50 51 $this->zipFile = mediaFN($this->downloadZipFile); 52 53 $this->tmpDir = mediaFN(getNS($this->origZipFile)); 54 $this->exportLinkedPages = intval($_REQUEST['exportLinkedPages']) == 1 ? true : false; 55 56 $this->namespace = $functions->getNamespaceFromID($_REQUEST['ns'], $PAGE); 57 $this->addParams = !empty($_REQUEST['addParams']); 58 59 $this->useTOCFile = !empty($_REQUEST['useTocFile']); 60 61 // set export Namespace - which is a virtual Root 62 $pg = noNS($ID); 63 if ( empty( $this->namespace ) ) { $this->namespace = $functions->getNamespaceFromID(getNS($ID), $pg); } 64 $this->exportNamespace = !empty($_REQUEST['ens']) && preg_match("%^" . $functions->getNamespaceFromID($_REQUEST['ens'], $pg) . "%", $this->namespace) ? $functions->getNamespaceFromID($_REQUEST['ens'], $pg) : $this->namespace; 65 66 $this->TOCMapWithoutTranslation = intval($_REQUEST['TOCMapWithoutTranslation']) == 1 ? true : false; 67 68 // Strip params that should be forwarded 69 $this->additionalParameters = $_REQUEST; 70 $functions->removeWikiVariables($this->additionalParameters, true); 71 72 $tmpID = $ID; 73 $ID = $this->origZipFile; 74 75 $INFO = pageinfo(); 76 if ( !$this->isCLI ) 77 { 78 // Workaround for the cron which cannot authenticate but has access to everything. 79 if ( $INFO['perm'] < AUTH_DELETE ) { 80 list ( $USER, $PASS) = $functions->basic_authentication(); 81 auth_login($USER, $PASS); 82 } 83 } 84 85 $ID = $tmpID; 86 } 87} 88 89?>