source: extensions/see_photos_by_user/include/function.see.inc.php @ 30497

Last change on this file since 30497 was 30497, checked in by ddtddt, 9 years ago
File size: 1.5 KB
Line 
1<?php 
2
3function see_username($id_user){
4$query = '
5    SELECT id, username
6    FROM ' . USERS_TABLE . '
7    WHERE id = \'' . $id_user . '\'
8    ;';
9        $result = pwg_query($query);
10        $row = pwg_db_fetch_assoc($result);
11        $username = str_replace(' ','_',$row['username']);
12        $username = str_replace('.','_',$username);
13return $username;
14}
15
16function see_userlist_nb_photo(){
17    global $conf;
18            $query = '
19SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU
20 FROM ' . USERS_TABLE . ' as UT
21 INNER JOIN ' . IMAGES_TABLE . ' AS IT ON IT.added_by = UT.id
22 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON IT.id = ic.image_id
23  ' . get_sql_condition_FandF
24                        (
25                        array
26                    (
27                    'forbidden_categories' => 'category_id',
28                    'visible_categories' => 'category_id',
29                    'visible_images' => 'id'
30                        ), 'WHERE'
31                ) . '
32 GROUP BY IT.added_by
33 HAVING PBU >' . $conf['see_photos_by_user_nbphotos'] . '
34 ORDER BY ' . $conf['see_photos_by_user_order'] . '
35 LIMIT ' . $conf['see_photos_by_user_limit'] . ';';
36
37        $result = pwg_query($query);
38
39    return $result;
40}
41
42function see_nb_photo(){
43$query = '
44 SELECT COUNT(DISTINCT(id)) AS PBU
45 FROM ' . IMAGES_TABLE . ';';
46
47$result = pwg_query($query);
48$row = pwg_db_fetch_assoc($result);
49
50    return $row['PBU'];
51}
52
53
54?>
Note: See TracBrowser for help on using the repository browser.