diff --git a/wire/core/PagefilesManager.php b/wire/core/PagefilesManager.php index 7ad86eae..d035cd3a 100644 --- a/wire/core/PagefilesManager.php +++ b/wire/core/PagefilesManager.php @@ -519,7 +519,19 @@ class PagefilesManager extends Wire { $publicPath = $path . $page->id . '/'; $securePath = $path . $securePrefix . $page->id . '/'; } + /* @todo 3.0.150: + $filesPublic = true; + if(!$page->isPublic()) { + // page not publicly viewable to all, check if files are public or not + if($config->pagefileSecure) { + $filesPublic = false; + } else if($page->template && $page->template->pagefileSecure) { + $filesPublic = false; // 3.0.150+ + } + } + if($filesPublic) { + */ if($page->isPublic() || !$config->pagefileSecure) { // use the public path, renaming a secure path to public if it exists if(is_dir($securePath) && !is_dir($publicPath)) { diff --git a/wire/core/Template.php b/wire/core/Template.php index 599f1180..b863523f 100644 --- a/wire/core/Template.php +++ b/wire/core/Template.php @@ -81,6 +81,7 @@ * @property int|bool $noAppendTemplateFile Disabe automatic append of $config->appendTemplateFile (if in use). #pw-group-files * @property string $prependFile File to prepend to template file (separate from $config->prependTemplateFile). #pw-group-files * @property string $appendFile File to append to template file (separate from $config->appendTemplateFile). #pw-group-files + * @property bool $pagefileSecure Use secure pagefiles for pages using this template? (3.0.150+) #pw-group-files * * Page Editor * @@ -263,6 +264,7 @@ class Template extends WireData implements Saveable, Exportable { 'noAppendTemplateFile' => 0, // disable automatic inclusion of $config->appendTemplateFile 'prependFile' => '', // file to prepend (relative to /site/templates/) 'appendFile' => '', // file to append (relative to /site/templates/) + 'pagefileSecure' => false, // secure files connected with page? (3.0.150+) 'tabContent' => '', // label for the Content tab (if different from 'Content') 'tabChildren' => '', // label for the Children tab (if different from 'Children') 'nameLabel' => '', // label for the "name" property of the page (if something other than "Name") diff --git a/wire/core/WireHttp.php b/wire/core/WireHttp.php index ba918b68..0130d058 100644 --- a/wire/core/WireHttp.php +++ b/wire/core/WireHttp.php @@ -29,6 +29,7 @@ * @method int sendFile($filename, array $options = array(), array $headers = array()) * @method string download($fromURL, $toFile, array $options = array()) * + * @todo add proxy server support (3.0.150+) * */ diff --git a/wire/modules/Inputfield/InputfieldForm.module b/wire/modules/Inputfield/InputfieldForm.module index 25378529..d913dbfc 100644 --- a/wire/modules/Inputfield/InputfieldForm.module +++ b/wire/modules/Inputfield/InputfieldForm.module @@ -265,6 +265,7 @@ class InputfieldForm extends InputfieldWrapper { } // $fields $processNow = $numFieldsMatched > 0; + // @todo 3.0.150: if($processNow) $child->set('showIfSkipped', false); // https://processwire.com/talk/topic/22130-forced-10-inputfield-dependency-issues/ if(!$processNow) break; if(self::debug) $this->debugNote("$child->name ($child->label) - matched: showIf($selector)"); diff --git a/wire/modules/Process/ProcessPageView.module b/wire/modules/Process/ProcessPageView.module index 247ddf82..f3496157 100644 --- a/wire/modules/Process/ProcessPageView.module +++ b/wire/modules/Process/ProcessPageView.module @@ -365,6 +365,7 @@ class ProcessPageView extends Process { $numParts = substr_count($it, '/'); if($numParts > $config->maxUrlDepth) return null; + // if($this->isSecurePagefileUrl($it)) { // @todo replace next line with this in 3.0.150 if($config->pagefileSecure) { $page = $this->checkRequestFile($it); if(is_object($page)) { @@ -945,6 +946,38 @@ class ProcessPageView extends Process { public function setDelayRedirects($delayRedirects) { $this->delayRedirects = $delayRedirects ? true : false; } + + /** + * Are secure pagefiles possible on this system and url? + * + * @param string $url + * @return bool + * @todo enable in 3.0.150 + * + protected function isSecurePagefileUrl($url) { + $config = $this->wire('config'); + + // if URL does not start from root, prepend root + if(strpos($url, $config->urls->root) !== 0) $url = $config->urls->root . ltrim($url, '/'); + + // if URL is not pointing to the files structure, then this is not a files URL + if(strpos($url, $config->urls->files) !== 0) return false; + + // pagefileSecure option is enabled and URL pointing to files + if($config->pagefileSecure) return true; + + // check if any templates allow pagefileSecure option + $allow = false; + foreach($this->wire('templates') as $template) { + if(!$template->pagefileSecure) continue; + $allow = true; + break; + } + + // if at least one template supports pagefileSecure option we will return true here + return $allow; + } + */ }