mirror of
https://github.com/processwire/processwire.git
synced 2025-08-15 19:24:28 +02:00
Add a few to-do code snippets, comments and notes for 3.0.150+ (next dev branch after master merge)
This commit is contained in:
@@ -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)) {
|
||||
|
@@ -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")
|
||||
|
@@ -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+)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@@ -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)");
|
||||
|
@@ -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)) {
|
||||
@@ -946,5 +947,37 @@ class ProcessPageView extends Process {
|
||||
$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;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user