tag cloud: use dba for db request
This commit is contained in:
parent
655b2cd0d3
commit
ac6b191976
1 changed files with 9 additions and 9 deletions
|
@ -168,7 +168,8 @@ function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA
|
||||||
|
|
||||||
$item_condition = item_condition();
|
$item_condition = item_condition();
|
||||||
$sql_options = item_permissions_sql($uid);
|
$sql_options = item_permissions_sql($uid);
|
||||||
$count = intval($count);
|
$limit = $count ? sprintf("LIMIT %d", intval($count)) : "";
|
||||||
|
|
||||||
if ($flags) {
|
if ($flags) {
|
||||||
if ($flags === 'wall') {
|
if ($flags === 'wall') {
|
||||||
$sql_options .= " AND `item`.`wall` ";
|
$sql_options .= " AND `item`.`wall` ";
|
||||||
|
@ -180,16 +181,15 @@ function tagadelic($uid, $count = 0, $owner_id = 0, $flags = '', $type = TERM_HA
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch tags
|
// Fetch tags
|
||||||
$r = q("SELECT `term`, COUNT(`term`) AS `total` FROM `term`
|
$r = dba::p("SELECT `term`, COUNT(`term`) AS `total` FROM `term`
|
||||||
LEFT JOIN `item` ON `term`.`oid` = `item`.`id`
|
LEFT JOIN `item` ON `term`.`oid` = `item`.`id`
|
||||||
WHERE `term`.`uid` = %d AND `term`.`type` = %d
|
WHERE `term`.`uid` = ? AND `term`.`type` = ?
|
||||||
AND `term`.`otype` = %d
|
AND `term`.`otype` = ?
|
||||||
AND $item_condition $sql_options
|
AND $item_condition $sql_options
|
||||||
GROUP BY `term` ORDER BY `total` DESC %s",
|
GROUP BY `term` ORDER BY `total` DESC ? $limit",
|
||||||
intval($uid),
|
$uid,
|
||||||
intval($type),
|
$type,
|
||||||
intval(TERM_OBJ_POST),
|
TERM_OBJ_POST
|
||||||
((intval($count)) ? "LIMIT $count" : '')
|
|
||||||
);
|
);
|
||||||
if(!DBM::is_result($r)) {
|
if(!DBM::is_result($r)) {
|
||||||
return array();
|
return array();
|
||||||
|
|
Loading…
Reference in a new issue