Merged bugfixes from asfonz branch

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2@65261 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2008-11-05 03:30:56 +00:00 committed by Sam Minnee
parent 7b60ec00e2
commit 903326869a
4 changed files with 33 additions and 19 deletions

View File

@ -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 .= "<p><b>" . self::full_func_name($item,true) . "</b>\n<br />\n";
$result .= isset($item['line']) ? "line $item[line] of " : '';

View File

@ -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";

View File

@ -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;
}

View File

@ -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,