Commit 3df726de authored by Alexander Butenko's avatar Alexander Butenko

Merge pull request #472 from avbdr/master

fixes
parents a62e491a ff09f83e
...@@ -887,7 +887,7 @@ class MysqliDb ...@@ -887,7 +887,7 @@ class MysqliDb
if (is_array($customFields)) { if (is_array($customFields)) {
foreach ($customFields as $key => $value) { foreach ($customFields as $key => $value) {
$customFields[$key] = preg_replace("/[^-a-z0-9\.\(\),_`]+/i", '', $value); $customFields[$key] = preg_replace("/[^-a-z0-9\.\(\),_` ]+/i", '', $value);
} }
$orderByField = 'FIELD (' . $orderByField . ', "' . implode('","', $customFields) . '")'; $orderByField = 'FIELD (' . $orderByField . ', "' . implode('","', $customFields) . '")';
...@@ -1265,7 +1265,11 @@ class MysqliDb ...@@ -1265,7 +1265,11 @@ class MysqliDb
$value = $tableData[$column]; $value = $tableData[$column];
if (!$isInsert) { if (!$isInsert) {
$this->_query .= "`" . $column . "` = "; if(strpos($column,'.')===false) {
$this->_query .= "`" . $column . "` = ";
} else {
$this->_query .= str_replace('.','.`',$column) . "` = ";
}
} }
// Subquery value // Subquery value
......
...@@ -401,11 +401,15 @@ class dbObject { ...@@ -401,11 +401,15 @@ class dbObject {
$joinObj = new $objectName; $joinObj = new $objectName;
if (!$key) if (!$key)
$key = $objectName . "id"; $key = $objectName . "id";
if (!$primaryKey)
$primaryKey = $joinObj->primaryKey; if (!$primaryKey)
$primaryKey = MysqliDb::$prefix . $joinObj->dbTable . "." . $joinObj->primaryKey;
$joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " . if (!strchr ($key, '.'))
MysqliDb::$prefix . "{$joinObj->dbTable}.{$primaryKey}"; $joinStr = MysqliDb::$prefix . $this->dbTable . ".{$key} = " . $primaryKey;
else
$joinStr = MysqliDb::$prefix . "{$key} = " . $primaryKey;
$this->db->join ($joinObj->dbTable, $joinStr, $joinType); $this->db->join ($joinObj->dbTable, $joinStr, $joinType);
return $this; return $this;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment