Last change
on this file since 30461 was
30415,
checked in by ddtddt, 10 years ago
|
[extensions] - see_photos_by_user - users home page
|
File size:
1.4 KB
|
Line | |
---|
1 | <?php |
---|
2 | |
---|
3 | function 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 | |
---|
13 | return $username; |
---|
14 | } |
---|
15 | |
---|
16 | function see_userlist_nb_photo(){ |
---|
17 | global $conf; |
---|
18 | $query = ' |
---|
19 | SELECT 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 | |
---|
42 | function 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.