Skip to content

Commit

Permalink
Escape table names in StructuralDBElement
Browse files Browse the repository at this point in the history
Fixes issue #66
  • Loading branch information
jbtronics committed Aug 6, 2019
1 parent 33cab45 commit e07fd54
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/Base/StructuralDBElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,8 @@ public function getSubelements($recursive)
if (! is_array($this->subelements)) {
$this->subelements = array();

$query_data = $this->database->query('SELECT * FROM ' . $this->tablename .
' WHERE parent_id <=> ? ORDER BY name ASC', array($this->getID()));
$query_data = $this->database->query('SELECT * FROM `' . $this->tablename .
'` WHERE parent_id <=> ? ORDER BY name ASC', array($this->getID()));

$class = get_class($this);
foreach ($query_data as $row) {
Expand Down Expand Up @@ -741,8 +741,8 @@ public static function checkValuesValidity(&$database, &$current_user, &$log, &$
// we search for an element with the same name and parent ID, there shouldn't be one!
$id = ($is_new) ? -1 : $values['id'];
$query_data = $database->query(
'SELECT * FROM '. $parent_element->getTablename() .
' WHERE name=? AND parent_id <=> ? AND id<>?',
'SELECT * FROM `'. $parent_element->getTablename() .
'` WHERE name=? AND parent_id <=> ? AND id<>?',
array($values['name'], $values['parent_id'], $id)
);
if (count($query_data) > 0) {
Expand Down

0 comments on commit e07fd54

Please sign in to comment.