MINOR Database quoting in TreeDropdownField (fixes #5484) (from r103515)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112146 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-13 03:56:48 +00:00
parent 16f83851db
commit 077a119cfb
2 changed files with 3 additions and 3 deletions

View File

@ -241,7 +241,7 @@ class TreeDropdownField extends FormField {
if ( $this->searchCallback )
$res = call_user_func($this->searchCallback, $this->sourceObject, $this->labelField, $this->search);
else
$res = DataObject::get($this->sourceObject, "$this->labelField LIKE '%$this->search%'");
$res = DataObject::get($this->sourceObject, "\"$this->labelField\" LIKE '%$this->search%'");
if( $res ) {
// iteratively fetch the parents in bulk, until all the leaves can be accessed using the tree control
@ -250,7 +250,7 @@ class TreeDropdownField extends FormField {
$this->searchIds[$row->ID] = true;
}
while (!empty($parents)) {
$res = DB::query('SELECT "ParentID", "ID" FROM '.$this->sourceObject.' WHERE "ID" in ('.implode(',',array_keys($parents)).')');
$res = DB::query('SELECT "ParentID", "ID" FROM \"' . $this->sourceObject . '\" WHERE "ID" in ('.implode(',',array_keys($parents)).')');
$parents = array();
foreach($res as $row) {

View File

@ -92,7 +92,7 @@ if (isset($_GET['url'])) {
}
}
// Fix glitches in URL generation
// Remove base folders from the URL if webroot is hosted in a subfolder
if (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) $url = substr($url, strlen(BASE_URL));
if (isset($_GET['debug_profile'])) {