Skip to content

Commit b57e96e

Browse files
author
Marco Cesarato
committed
Added get_where_[table] and get_query_where_[table] Hooks
1 parent edbe483 commit b57e96e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PHP Database Web API
22
![](cover.png)
33

4-
**Version:** 0.6.130 beta
4+
**Version:** 0.6.131 beta
55

66
**Github:** https://github.com/marcocesarato/Database-Web-API
77

includes/classes/API.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -660,11 +660,12 @@ private function get($query, $db = null) {
660660
// build WHERE query
661661
$restriction = $this->auth->permissionSQL($query['table'], 'READ');
662662
if(!empty($query['where']) && is_array($query['where'])) {
663-
$where = $this->parseWhere($query['table'], $query['where'], $sql);
664-
$sql = $where["sql"] . ' AND ' . $restriction;
665-
$where_values = $where["values"];
663+
$query['where'] = $this->hooks->apply_filters('get_query_where_' . strtolower($query['table']), $query['where']);
664+
$where = $this->parseWhere($query['table'], $query['where'], $sql);
665+
$sql = $where["sql"] . ' AND ' . $restriction;
666+
$where_values = $where["values"];
666667
} else if(!empty($restriction)) {
667-
$sql .= ' WHERE ' . $restriction;
668+
$sql .= ' WHERE ' . $restriction . $this->hooks->apply_filters('get_where_' . strtolower($query['table']), "");
668669
}
669670

670671
// build ORDER query

0 commit comments

Comments
 (0)