summaryrefslogtreecommitdiff
path: root/includes/model/UserGroups_model.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-01-21 13:58:53 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-01-21 13:58:53 +0100
commit9a3ad8883403949a59e8935497a548ec536f1d40 (patch)
treed3c27912c925e53bc240640ccc1133d8f87f1fd3 /includes/model/UserGroups_model.php
parentf7c09cb7ff84db1004a4fa83a70735475702023f (diff)
Changed from mysqli to PDO, some refactorings, faster sql queries
Diffstat (limited to 'includes/model/UserGroups_model.php')
-rw-r--r--includes/model/UserGroups_model.php20
1 files changed, 12 insertions, 8 deletions
diff --git a/includes/model/UserGroups_model.php b/includes/model/UserGroups_model.php
index c390cd20..d4baf638 100644
--- a/includes/model/UserGroups_model.php
+++ b/includes/model/UserGroups_model.php
@@ -1,18 +1,22 @@
<?php
+use Engelsystem\Database\DB;
+
/**
* Returns users groups
*
* @param array $user
- * @return array|false
+ * @return array
*/
function User_groups($user)
{
- return sql_select('
- SELECT `Groups`.*
- FROM `UserGroups`
- JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
- WHERE `UserGroups`.`uid`=\'' . sql_escape($user['UID']) . '\'
- ORDER BY `UserGroups`.`group_id`
- ');
+ return DB::select('
+ SELECT `Groups`.*
+ FROM `UserGroups`
+ JOIN `Groups` ON `Groups`.`UID`=`UserGroups`.`group_id`
+ WHERE `UserGroups`.`uid`=?
+ ORDER BY `UserGroups`.`group_id`
+ ',
+ [$user['UID']]
+ );
}