Fix limit and search parameters in frio_acl_lookup
This commit is contained in:
parent
d3fa7ae5ae
commit
1b2334745a
1 changed files with 40 additions and 39 deletions
|
@ -292,13 +292,16 @@ function frio_acl_lookup(App $a, &$results)
|
||||||
|
|
||||||
// we introduce a new search type, r should do the same query like it's
|
// we introduce a new search type, r should do the same query like it's
|
||||||
// done in /mod/contacts for connections
|
// done in /mod/contacts for connections
|
||||||
if ($results["type"] == "r") {
|
if ($results["type"] !== "r") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$searching = false;
|
$searching = false;
|
||||||
if ($search) {
|
if ($results["search"]) {
|
||||||
$search_hdr = $search;
|
$search_txt = dbesc(protect_sprintf(preg_quote($results["search"])));
|
||||||
$search_txt = dbesc(protect_sprintf(preg_quote($search)));
|
|
||||||
$searching = true;
|
$searching = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
if ($searching) {
|
if ($searching) {
|
||||||
$sql_extra .= " AND (`attag` LIKE '%%" . dbesc($search_txt) . "%%' OR `name` LIKE '%%" . dbesc($search_txt) . "%%' OR `nick` LIKE '%%" . dbesc($search_txt) . "%%') ";
|
$sql_extra .= " AND (`attag` LIKE '%%" . dbesc($search_txt) . "%%' OR `name` LIKE '%%" . dbesc($search_txt) . "%%' OR `nick` LIKE '%%" . dbesc($search_txt) . "%%') ";
|
||||||
|
@ -309,16 +312,15 @@ function frio_acl_lookup(App $a, &$results)
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
$r = q("SELECT COUNT(*) AS `total` FROM `contact`
|
||||||
WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ",
|
WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra ", intval($_SESSION['uid']));
|
||||||
intval($_SESSION['uid']));
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
$total = $r[0]["total"];
|
$total = $r[0]["total"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_extra3 = Widget::unavailableNetworks();
|
$sql_extra3 = Widget::unavailableNetworks();
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT 100 ",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra3 ORDER BY `name` ASC LIMIT %d, %d ",
|
||||||
intval($_SESSION['uid'])
|
intval($_SESSION['uid']), intval($results['start']), intval($results['count'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$contacts = [];
|
$contacts = [];
|
||||||
|
@ -332,7 +334,6 @@ function frio_acl_lookup(App $a, &$results)
|
||||||
$results["items"] = $contacts;
|
$results["items"] = $contacts;
|
||||||
$results["tot"] = $total;
|
$results["tot"] = $total;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Manipulate the data of the item
|
* @brief Manipulate the data of the item
|
||||||
|
|
Loading…
Reference in a new issue