Skip to content

Commit

Permalink
Update installer to fix issue with profiles that have no /install/fil…
Browse files Browse the repository at this point in the history
…es/ directory. If the profile had no files dir, then when admin tried to login they would get a "this request appears to be forged" error.
  • Loading branch information
ryancramerdesign committed Feb 10, 2013
1 parent 16e20c8 commit a77273c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion htaccess.txt
Expand Up @@ -97,7 +97,7 @@ DirectoryIndex index.php index.html index.htm
# Block access to any htaccess files
RewriteCond %{REQUEST_URI} (^|/)\.htaccess$ [NC,OR]
# Block access to protected assets directories
RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install)($|/.*$) [OR]
RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) [OR]
# Block acceess to the /site/install/ directory
RewriteCond %{REQUEST_URI} (^|/)(site|site-[^/]+)/install($|/.*$) [OR]
# Block dirs in /site/assets/ dirs that start with a hyphen
Expand Down
14 changes: 6 additions & 8 deletions install.php
Expand Up @@ -12,7 +12,7 @@
* reason, then you'll want to delete that file. This was implemented just in case someone doesn't delete the installer.
*
* ProcessWire 2.x
* Copyright (C) 2012 by Ryan Cramer
* Copyright (C) 2013 by Ryan Cramer
* Licensed under GNU/GPL v2, see LICENSE.TXT
*
* http://processwire.com
Expand Down Expand Up @@ -378,12 +378,11 @@ protected function profileImport($mysqli) {
$this->profileImportSQL($mysqli, $profile . "install.sql");
$this->ok("Imported: {$profile}install.sql");

if(!is_dir("./site/assets/files/") && is_dir($profile . "files")) {
$this->mkdir("./site/assets/cache/");
$this->mkdir("./site/assets/logs/");
$this->mkdir("./site/assets/sessions/");
$this->profileImportFiles($profile);
}
if(is_dir($profile . "files")) $this->profileImportFiles($profile);
else $this->mkdir("./site/assets/files/");
$this->mkdir("./site/assets/cache/");
$this->mkdir("./site/assets/logs/");
$this->mkdir("./site/assets/sessions/");

} else {
$this->ok("A profile is already imported, skipping...");
Expand Down Expand Up @@ -553,7 +552,6 @@ protected function adminAccountSave($wire) {

}


/******************************************************************************************************************
* OUTPUT FUNCTIONS
*
Expand Down
1 change: 1 addition & 0 deletions wire/core/PageTraversal.php
Expand Up @@ -45,6 +45,7 @@ public static function children(page $page, $selector = '', $options = array())
*
*/
public static function child(Page $page, $selector = '', $options = array()) {
if(!$page->numChildren) return new NullPage();
$selector .= ($selector ? ', ' : '') . "limit=1";
if(strpos($selector, 'start=') === false) $selector .= ", start=0"; // prevent pagination
$children = self::children($page, $selector, $options);
Expand Down

0 comments on commit a77273c

Please sign in to comment.