aboutsummaryrefslogtreecommitdiffstats
path: root/include/apps.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/apps.php')
-rw-r--r--include/apps.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/include/apps.php b/include/apps.php
index b3d0c954e..7439be6d4 100644
--- a/include/apps.php
+++ b/include/apps.php
@@ -370,12 +370,29 @@ function app_installed($uid,$app) {
}
-function app_list($uid, $deleted = false) {
+function app_list($uid, $deleted = false, $cat = '') {
if($deleted)
$sql_extra = " and app_deleted = 1 ";
else
$sql_extra = " and app_deleted = 0 ";
+ if($cat) {
+ $r = q("select oid from term where otype = %d and term = '%s'",
+ intval(TERM_OBJ_APP),
+ dbesc($cat)
+ );
+ if(! $r)
+ return $r;
+ $sql_extra .= " and app.id in ( ";
+ $s = '';
+ foreach($r as $rr) {
+ if($s)
+ $s .= ',';
+ $s .= intval($rr['oid']);
+ }
+ $sql_extra .= $s . ') ';
+ }
+
$r = q("select * from app where app_channel = %d $sql_extra order by app_name asc",
intval($uid)
);