mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-28 20:29:15 +02:00
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:
parent
16f83851db
commit
077a119cfb
@ -241,7 +241,7 @@ class TreeDropdownField extends FormField {
|
|||||||
if ( $this->searchCallback )
|
if ( $this->searchCallback )
|
||||||
$res = call_user_func($this->searchCallback, $this->sourceObject, $this->labelField, $this->search);
|
$res = call_user_func($this->searchCallback, $this->sourceObject, $this->labelField, $this->search);
|
||||||
else
|
else
|
||||||
$res = DataObject::get($this->sourceObject, "$this->labelField LIKE '%$this->search%'");
|
$res = DataObject::get($this->sourceObject, "\"$this->labelField\" LIKE '%$this->search%'");
|
||||||
|
|
||||||
if( $res ) {
|
if( $res ) {
|
||||||
// iteratively fetch the parents in bulk, until all the leaves can be accessed using the tree control
|
// 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;
|
$this->searchIds[$row->ID] = true;
|
||||||
}
|
}
|
||||||
while (!empty($parents)) {
|
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();
|
$parents = array();
|
||||||
|
|
||||||
foreach($res as $row) {
|
foreach($res as $row) {
|
||||||
|
2
main.php
2
main.php
@ -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 (substr(strtolower($url), 0, strlen(BASE_URL)) == strtolower(BASE_URL)) $url = substr($url, strlen(BASE_URL));
|
||||||
|
|
||||||
if (isset($_GET['debug_profile'])) {
|
if (isset($_GET['debug_profile'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user