Changeset 31460 for extensions/see_photos_by_user/include
- Timestamp:
- Mar 19, 2016, 6:33:31 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/see_photos_by_user/include/function.see.inc.php
r30497 r31460 1 1 <?php 2 2 // +-----------------------------------------------------------------------+ 3 // | See photos by user plugin for piwigo | 4 // +-----------------------------------------------------------------------+ 5 // | Copyright(C) 2014 - 2016 ddtddt http://temmii.com/piwigo/ | 6 // +-----------------------------------------------------------------------+ 7 // | This program is free software; you can redistribute it and/or modify | 8 // | it under the terms of the GNU General Public License as published by | 9 // | the Free Software Foundation | 10 // | | 11 // | This program is distributed in the hope that it will be useful, but | 12 // | WITHOUT ANY WARRANTY; without even the implied warranty of | 13 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 // | General Public License for more details. | 15 // | | 16 // | You should have received a copy of the GNU General Public License | 17 // | along with this program; if not, write to the Free Software | 18 // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | 19 // | USA. | 20 // +-----------------------------------------------------------------------+ 3 21 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 $username = str_replace('.','_',$username); 13 return $username; 22 $query = 'SELECT id, username FROM ' . USERS_TABLE . ' WHERE id = \'' . $id_user . '\';'; 23 $result = pwg_query($query); 24 $row = pwg_db_fetch_assoc($result); 25 $username = str_replace(' ','_',$row['username']); 26 $username = str_replace('.','_',$username); 27 return $username; 14 28 } 15 29 16 30 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'] . ';'; 31 global $conf; 32 $query = ' 33 SELECT UT.id, UT.username, COUNT(DISTINCT(IT.id)) AS PBU 34 FROM ' . USERS_TABLE . ' as UT 35 INNER JOIN ' . IMAGES_TABLE . ' AS IT ON IT.added_by = UT.id 36 INNER JOIN ' . IMAGE_CATEGORY_TABLE . ' AS ic ON IT.id = ic.image_id 37 ' . get_sql_condition_FandF( 38 array( 39 'forbidden_categories' => 'category_id', 40 'visible_categories' => 'category_id', 41 'visible_images' => 'id' 42 ), 'WHERE' 43 ) . ' 44 GROUP BY IT.added_by 45 HAVING PBU >' . $conf['see_photos_by_user_nbphotos'] . ' 46 ORDER BY ' . $conf['see_photos_by_user_order'] . ' 47 LIMIT ' . $conf['see_photos_by_user_limit'] . ';'; 36 48 37 $result = pwg_query($query); 38 39 return $result; 49 $result = pwg_query($query); 50 return $result; 40 51 } 41 52 42 53 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']; 54 $query = 'SELECT COUNT(DISTINCT(id)) AS PBU FROM ' . IMAGES_TABLE . ';'; 55 $result = pwg_query($query); 56 $row = pwg_db_fetch_assoc($result); 57 return $row['PBU']; 51 58 } 52 59 53 54 60 ?>
Note: See TracChangeset
for help on using the changeset viewer.