diff --git a/core/Debug.php b/core/Debug.php index 9f1258f07..2dae2288f 100644 --- a/core/Debug.php +++ b/core/Debug.php @@ -279,7 +279,7 @@ class Debug { foreach($bt as $item) { if(Director::is_ajax() && !$ignoreAjax) { $result .= self::full_func_name($item,true) . "\n"; - $result .= "line $item[line] of " . basename($item['file']) . "\n\n"; + if(isset($item['line']) && isset($item['file'])) $result .= "line $item[line] of " . basename($item['file']) . "\n\n"; } else { $result .= "

" . self::full_func_name($item,true) . "\n
\n"; $result .= isset($item['line']) ? "line $item[line] of " : ''; diff --git a/core/ManifestBuilder.php b/core/ManifestBuilder.php index eb7d64b3c..c4b308658 100644 --- a/core/ManifestBuilder.php +++ b/core/ManifestBuilder.php @@ -143,15 +143,28 @@ class ManifestBuilder { if(@is_dir("$baseDir/$filename/") && file_exists("$baseDir/$filename/_config.php") && !file_exists("$baseDir/$filename/_manifest_exclude")) { - $manifest .= "require_once(\"$baseDir/$filename/_config.php\");\n"; // Include this so that we're set up for connecting to the database // in the rest of the manifest builder require_once("$baseDir/$filename/_config.php"); } } - if(!project()) + + foreach($topLevel as $filename) { + if($filename[0] == '.') continue; + if(project() && project() == $filename) continue; + if(@is_dir("$baseDir/$filename/") && + file_exists("$baseDir/$filename/_config.php") && + !file_exists("$baseDir/$filename/_manifest_exclude")) { + $manifest .= "require_once(\"$baseDir/$filename/_config.php\");\n"; + } + } + + if(!project()) { user_error("\$project isn't set", E_USER_WARNING); + } else { + $manifest .= "require_once(\"$baseDir/" . project() . "/_config.php\");\n"; + } // Template & CSS manifest $templateManifest = array(); @@ -494,10 +507,16 @@ class ManifestBuilder { foreach($topLevel as $filename) { if($filename[0] == '.') continue; + if(project() && $filename == project()) continue; if(@is_dir("$baseDir/$filename/") && file_exists("$baseDir/$filename/_config.php")) { $manifest .= "require_once(\"$baseDir/$filename/_config.php\");\n"; } } + + // Include the project _config.php last, so it can override setting in module _config.phps + if(project()) { + $manifest .= "require_once(\"$baseDir/" . project() ."/_config.php\");\n"; + } $manifest .= "\$_TEMPLATE_MANIFEST = " . var_export($_TEMPLATE_MANIFEST, true) . ";\n"; $manifest .= "\$_CSS_MANIFEST = " . var_export($_CSS_MANIFEST, true) . ";\n"; diff --git a/forms/ComplexTableField.php b/forms/ComplexTableField.php index fb7fc8b85..dd37b4617 100755 --- a/forms/ComplexTableField.php +++ b/forms/ComplexTableField.php @@ -304,18 +304,11 @@ JS; } if($this->getParentClass()) { - $parentIdName = $this->getParentIdName($this->getParentClass(), $this->sourceClass); - if(!$parentIdName) { - user_error("ComplexTableField::DetailForm() Cannot automatically - determine 'has-one'-relationship to parent, - please use setParentClass() to set it manually", - E_USER_WARNING); - return; - } // add relational fields $detailFields->push(new HiddenField("ctf[parentClass]"," ",$this->getParentClass())); - if( $this->relationAutoSetting ) + $parentIdName = $this->getParentIdName($this->getParentClass(), $this->sourceClass); + if( $parentIdName && $this->relationAutoSetting ) $detailFields->push(new HiddenField("$parentIdName"," ",$ID)); } @@ -327,6 +320,8 @@ JS; $detailFields->push(new HiddenField("ctf[childID]","",$childID)); } + $detailFields->push(new HiddenField("ctf[ID]","",$ID)); + // add a namespaced ID instead thats "converted" by saveComplexTableField() $detailFields->push(new HiddenField("ctf[ClassName]","",$this->sourceClass)); @@ -408,7 +403,7 @@ JS; $this->pageSize = 1; - if(is_numeric($_REQUEST['ctf']['start'])) { + if(isset($_REQUEST['ctf']['start']) && is_numeric($_REQUEST['ctf']['start'])) { $this->unpagedSourceItems->setPageLimits($_REQUEST['ctf']['start'], $this->pageSize, $this->totalCount); } @@ -475,11 +470,11 @@ JS; } function PopupCurrentItem() { - return $_REQUEST['ctf']['start']+1; + if(isset($_REQUEST['ctf']['start'])) return $_REQUEST['ctf']['start']+1; } function PopupFirstLink() { - if(!is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == 0) { + if(!isset($_REQUEST['ctf']['start']) || !is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == 0) { return null; } @@ -489,7 +484,7 @@ JS; } function PopupLastLink() { - if(!is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == $this->totalCount-1) { + if(!isset($_REQUEST['ctf']['start']) || !is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == $this->totalCount-1) { return null; } @@ -499,7 +494,7 @@ JS; } function PopupNextLink() { - if(!is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == $this->totalCount-1) { + if(!isset($_REQUEST['ctf']['start']) || !is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == $this->totalCount-1) { return null; } @@ -510,7 +505,7 @@ JS; } function PopupPrevLink() { - if(!is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == 0) { + if(!isset($_REQUEST['ctf']['start']) || !is_numeric($_REQUEST['ctf']['start']) || $_REQUEST['ctf']['start'] == 0) { return null; } diff --git a/security/Security.php b/security/Security.php index d819b394d..89af6e39a 100644 --- a/security/Security.php +++ b/security/Security.php @@ -741,7 +741,7 @@ class Security extends Controller { 'salt' => null, 'algorithm' => 'none'); - } elseif((self::$encryptPasswords == false) || ($algorithm == 'none')) { + } elseif((!$algorithm && self::$encryptPasswords == false) || ($algorithm == 'none')) { // The password should not be encrypted return array('password' => substr($password, 0, 64), 'salt' => null,