Browse Source

Fix warning, see #132

Maurits van der Schee 7 years ago
parent
commit
c070ff30a8
1 changed files with 9 additions and 1 deletions
  1. 9
    1
      api.php

+ 9
- 1
api.php View File

@@ -167,6 +167,14 @@ class MySQL implements DatabaseInterface {
167 167
 		return "$sql LIMIT $limit OFFSET $offset";
168 168
 	}
169 169
 
170
+	public function addOrderByDifferenceToSql($sql,$field,$direction) {
171
+		if ($this->isGeometryType($field)) {
172
+			return "$sql ORDER BY ST_Distance(!, ?) $direction";
173
+		} else {
174
+			return "$sql ORDER BY ABS(! - ?) $direction";
175
+		}
176
+	}
177
+
170 178
 	public function likeEscape($string) {
171 179
 		return addcslashes($string,'%_');
172 180
 	}
@@ -1738,7 +1746,7 @@ class PHP_CRUD_API {
1738 1746
 			foreach ($_FILES as $name => $file) {
1739 1747
 				foreach ($file as $key => $value) {
1740 1748
 					switch ($key) {
1741
-						case 'tmp_name': $files[$name] = base64_encode(file_get_contents($value)); break;
1749
+						case 'tmp_name': $files[$name] = $value?base64_encode(file_get_contents($value)):''; break;
1742 1750
 						default: $files[$name.'_'.$key] = $value;
1743 1751
 					}
1744 1752
 				}

Loading…
Cancel
Save